Ⅰ. 插件描述
Vim plugin providing test execution and recall and execution of last test when in implementation files.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'cyphactor/vim-test-recall'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'cyphactor/vim-test-recall'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'cyphactor/vim-test-recall'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/cyphactor/vim-test-recall
Ⅳ. 文档说明
# test-recall.vim
test-recall.vim is a vim plugin that is focused centrally around making it
easier to run tests and get feedback appropriately in a the red, green,
refactor cycle.
It handles the normal use cases for running tests. However, it has an
additional killer feature, recollection. This means that it will
automatically recall the last test that you ran, and allow you to
rerun that test while in implementation code. This saves you the effort
of having to jump back and forth between the test and implementation
code during the red, green, refactor cycle.
Install
The following is the recommended approach using the vim8's built in package
- If you aren't using vim8 then upgrade to get the latest goodness.
cd ~/.vim/
git submodule add https://github.com/uptech/vim-test-recall.git pack/bundle/start/vim-test-recall
git add .
git commit -m "Added vim-test-recall plugin to my setup."
If you are using another method, you are on your own.
Usage
This plugin exposes a number of functions which are intended be used,
and probably mapped. The breakdown of these functions and what they do
is provided below.
RunAllTestsInCurrentTestFile()- runs all the tests in the current test fileRunNearestTest()- runs the test nearest the cursorRunAllRSpecTests()- runs all rspec tests across code baseRunAllCucumberFeatures()- runs all cucumber features across code baseRunWipCucumberFeatures()- run all wip'd cucumber features across code base
I personally have the above functions mapped as follows in my
vimrc.
" Map all the run test calls provided by vim-test-recall
map <leader>t :call RunAllTestsInCurrentTestFile()<cr>
map <leader>T :call RunNearestTest()<cr>
map <leader>a :call RunAllRSpecTests()<cr>
map <leader>c :call RunAllCucumberFeatures()<cr>
map <leader>w :call RunWipCucumberFeatures()<cr>
Configuration
The following are optional configs that if not set have common default fall back
- Any of the following could be set in a similar fashion as
- example in your
vimrc.
" set vim-test-recall.vim to use rspec with full backtraces
let g:vim_test_recall_rspec_command = 'rspec -b'
g:vim_test_recall_cucumber_command- if not set this first attempts to
- back to
bin/cucumberif present, after that it falls back to
zeus cucumber if `zeus.json is present, after that it falls back toscript/features if present, after that it falls back to `bundle exec
cucumber`.
g:vim_test_recall_rspec_command- if not set this first attempts to
- back to
bin/rspecif present, after that it falls back to `zeus
test if zeus.json` is present, after that it falls back toscript/test if present, after that it falls back to `bundle exec
rspec if Gemfile is present, after that it falls back to rspec`.
g:vim_test_recall_snapdragon_command- if not set this first attempts
- fall back to
bundle exec snapdragonifGemfileis present, after
that it falls back to snapdragon.
License
Copyright (c) Andrew De Ponte. Distributed under the same terms as Vim itself.
See :help license.