THIS PLUGIN IS NO LONGER WORKING with vim patch 7.4.260
This plugin opens a related test file of a given source file (and viceversa).
When you are editing a source file, eg: App.php
and you want to open the test file
you have to issue tt
and the AppTest.php
will be opened from your tests folder.
If the test file is missing you can create it on the fly.
- In PHP if you open
src/Name/App.php
and issuett
the plugin tries to opentests/Name/AppTest.php
- In Golang if you open
boat.go
and issuett
the plugin tries to openboat_test.go
... And viceversa! ;-)
You can use Vundle for install this plugin
Bundle 'wdalmut/vim-relatedtest'
You can redefine shortcuts
let g:relatedtest_open_command = '<C-t>'
Sometimes you need to set up where sources and tests folders are located, for doing
that you can set in your .exrc
file for your project.
For example for Symfony2 application you can limit the search operation in your
src
folder only...
let g:relatedtest_php_src="src/"
let g:relatedtest_php_tests="src/"
In order to exclude always a particular folder like: vendor
you can use
wildignore flag directly in your .vimrc
configuration file.
:set wildignore+=**/vendor/**
The open strategy comes in help when you want to open the related test in a new window, split, tab etc..
let g:relatedtest_open_strategy = 'vsp'
You can use any vim command as open strategy, the most common are:
- vsp (open in a vertical split)
- sp (open in an horizontal split)
- tabnew (open in a tab)
- e (open in the current window)