Ⅰ. 插件描述
a vim plugin to run a single mocha test or moduleⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'toranb/vim-mocha-special-blend'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'toranb/vim-mocha-special-blend'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'toranb/vim-mocha-special-blend'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/toranb/vim-mocha-special-blend
Ⅳ. 文档说明
# vim-mocha-special-blend
Ever want to run a single mocha test or module without having to find/replace?
The Plugin In Action

Installation
Use your plugin manager of choice.
git clone https://github.com/toranb/vim-mocha-special-blend ~/.vim/bundle/vim-mocha-special-blend
- Add
Plugin 'toranb/vim-mocha-special-blend'to .vimrc - Run
:PluginInstall
- Add
- Add
NeoBundle 'https://github.com/toranb/vim-mocha-special-blend'to .vimrc - Run
:NeoBundleInstall
- Add
- Add
Plug 'https://github.com/toranb/vim-mocha-special-blend'to .vimrc - Run
:PlugInstall
- Add
Requirements
You need a VIM version that was compiled with python support, which is typical
for most distributions on Linux/Mac. You can check this by runningvim --version | grep +python
if you get a hit you are in business.
This plugin will work with any build tool or test suite because the command it
runs is an argument you pass in at the end of the function you invoke (see below).
Usage
The plugin provides two commands:
RunSingleMochaTest
RunSingleMochaModuleAll arguments can be tab-completed. Ensure that your cursor is within a
module or function as appropriate for the command being called.
For ease of usage you can map the above actions to a shortcut. For example,
if you wanted leader mappings you could set something like the following in
your vimrc:
nmap <Leader>tm :call InvokeTestMethodByType()<CR>
function! InvokeTestMethodByType()
exe ':RunSingleMochaTest npm test'
endfunction
nmap <Leader>tc :call InvokeTestClassByType()<CR>
function! InvokeTestClassByType()
exe ':RunSingleMochaModule npm test'
endfunctionCredits
Most of the code used to write this plugin was stolen from the great Jarrod Taylor