Find your test and implementation files.
When your working on a software project you will often need to:
- Find and open the test for the current source file.
- Find and open the source file for the current test file.
- Find and run the test for the current source file you just modified.
This plugin provides a simple interface to find test and implementation files across different projects and languages.
Find the alternate file:
:echo alternate#FindAlternate()
Find the test file:
:echo alternate#FindTest()
Usage with open
:Open(alternate#FindAlternate())
Open the alternate file in the current window.
:OpenVertical(alternate#FindAlternate())
Open the alternate file in a new vertical split.
When you open a recognised file type, alternate examines your working directory for common project layout conventions. Once a layout convention is recognised alternate will use it to scan for alternate files.
(app|lib)/**/foo.rb <-> spec/**/foo_spec.rb
lib/**/foo.rb <-> spec/**/foo_spec.rb
**/foo.rb <-> test/**/foo_unit.rb
**/foo.py <-> test/**/test_foo.py
**/foo.py <-> **/test_foo.py
app/assets/javascripts/**/foo.js.coffee <-> spec/javascripts/**/foo_spec.js.coffee
**/foo.js.coffee <-> spec/**/foo_spec.js.coffee
src/**/foo.hs <-> testsuite/tests/**/Qcfoo.hs
**/Foo.cc <-> **/TestFoo.cc
**/foo.go <-> **/foo_test.go
main/**/App.java <-> test/**/AppTest.java
main/**/App.kt <-> test/**/AppTest.kt