Wednesday, July 15, 2015

Re: auto open test file from src file

On Wednesday, July 15, 2015 at 8:13:47 PM UTC-5, fredianiadrien wrote:
>
> For exemple if I have src/models/Model1.js open:
> <Leader> os => :vsp tests/models/Model1.spec.js
>
> For exemple if I have tests/views/View1.spec.js:
> <Leader> os => :vsp src/views/View1.js
>

I think this command should do what you want to open a test file from a source file:

:vsp tests/models/%:t:r.spec.%:e

This should open a source file from a test file:

:vsp src/models/%:t:r:r.%:e

You could either detect the filename with expand() to determine which pattern to use, or you could use an autocmd to set up a buffer-local mapping based on file extension or location.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: