Ⅰ. 插件描述
Vim plug-in for toggling between source and unit test filesⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'johnsyweb/toggle-unit-tests'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'johnsyweb/toggle-unit-tests'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'johnsyweb/toggle-unit-tests'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/johnsyweb/vim-tut
Ⅳ. 文档说明
TUT
Toggles betwixt source and unit test file
Introduction
Use this plug-in when you are doing Test-Driven Development [TDD] in any
language to quickly switch between unit-test and production code. To make this
really fast, bind the TUT command to a function key in your $VIMRC:
[F3] toggles between (header, ) source and test files.
nnoremap <F3> :<C-U>TUT<CR>This plug-in assumes source and unit test files are in the same directory.
Installation
I recommend installing pathogen.vim,
and then simply copy and paste:
cd ~/.vim/bundle
git clone git://github.com/johnsyweb/vim-tut.git
vim -cHelptags -cqOnce help tags have been generated, you can view the manual with:
:help toggle_unit_testsCommands
:TUTToggles betwixt source and unit test file
Mappings
<Leader>tutCalls :TUT.
Settings
By default, unit-test filenames are deemed to begin with 't_'.
Tell toggle_unit_tests.vim your own prefix by setting the following global
variable, perhaps in $VIMRC:
let g:unit_test_prefix='test_'Thanks
If you find this plug-in useful, please follow this repository on
GitHub and vote for it on
vim.org. If you have
something to say, you can contact johnsyweb on
Twitter and
GitHub.