vim-mocha-only


Ⅰ. 插件描述

A little vim plugin for toggling mocha "only" settings.

Ⅱ. 基本信息

创建日期:  2016-09-30
使用用户:  1
Github星:  1
插件作者:  Gerrard Lindsay

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'gerrard00/vim-mocha-only'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'gerrard00/vim-mocha-only'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'gerrard00/vim-mocha-only'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/gerrard00/vim-mocha-only

Ⅳ. 文档说明

# vim-mocha-only

I use Vim for Javascript development. I use Mocha for testing my Javascript.

I don't run Mocha tests from inside Vim. I use a separate terminal which automatically re-runs my tests when files change. If you run your tests directly inside Vim this isn't the plugin for you. Check out vim-mocha-special-blend which is probably more up your alley.

I wanted a way to quickly run only certain tests, but without actually running the tests in Vim. Here's a simple plugin to help do that by automatically adding .only to the test under your cursor.

Installation

I use vim-plug:

Plug 'gerrard00/vim-mocha-only', { 'for': ['javascript'] }

Usage

The plugin adds three commands:

:MochaOnlyAdd changes describe to describe.only or it to it.only. It also removes any other .only statements in the same buffer.

:MochaOnlyRemove changes describe.only to describe and it.only to it.

:MochaOnlyToggle calls add or remove as appropriate.

All three commands require that your cursor is placed on the line where the test function is declared.

I personally use toggle most of the time, so I added a mapping to my .vimrc file:

nnoremap <Leader>mo :MochaOnlyToggle<CR>

That way I can just do \mo to toggle away.

添加新评论