Ⅰ. 插件描述
Find your test and implementation files.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'compactcode/alternate-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'compactcode/alternate-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'compactcode/alternate-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/compactcode/alternate.vim
Ⅳ. 文档说明
# alternate.vim
Find your test and implementation files.
Why
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.
Usage
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.
How it works
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.
Recognised Conventions
Ruby
(app|lib)/**/foo.rb <-> spec/**/foo_spec.rb
lib/**/foo.rb <-> spec/**/foo_spec.rb
**/foo.rb <-> test/**/foo_unit.rbPython
**/foo.py <-> test/**/test_foo.py
**/foo.py <-> **/test_foo.py(Java|Coffee) Script
app/assets/javascripts/**/foo.js.coffee <-> spec/javascripts/**/foo_spec.js.coffee
**/foo.js.coffee <-> spec/**/foo_spec.js.coffeeHaskell
src/**/foo.hs <-> testsuite/tests/**/Qcfoo.hsC++
**/Foo.cc <-> **/TestFoo.ccGolang
**/foo.go <-> **/foo_test.go