Ⅰ. 插件描述
Lightweight vim plugin to open the associated spec of the file in the current buffer, in a split pane. Or... run the associated specs.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'mark-maxwell/vim-spec-split'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'mark-maxwell/vim-spec-split'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'mark-maxwell/vim-spec-split'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/mark-maxwell/vim-spec-split
Ⅳ. 文档说明
# Spec split
A Lightweight Vim plugin to open the associated spec file, in a split pane, for
the file you are editing in your current buffer. Or... to run the spec for
either the spec associated with the file open in your current buffer, or the
currently open spec (if a spec is open in your current buffer).
Works for Ruby/RSpec only... For now
Assumes that if you have a file: app/models/depth/here.rb, then your spec
would be: spec/models/depth/here_spec.rb<br/>
AND<br/>
if you have a file: lib/depth/here.rb, then your spec would be:spec/lib/depth/here_spec.rb
Includes Bonus reverse-splitting
*If you are already in a spec file, the same function that is used to find an
associated spec for a given file can be used to achieve the reverse: finding
the associated file for a given spec.*
Installation
With Vundle:
call Vundle#begin()
Plugin 'mark-maxwell/vim-spec-split'
call Vundle#end()Installation with pathogen is also an option.
Current functionality:
:call Vspec()If your current buffer contains a file that could possibly have a spec: open
the associated spec in a vertical split pane.<br/>
If your current buffer contains a spec file: open the associated file in a
vertical split pane.
:call Hspec()Exactly the same functionality as Vspec(), except the split panes are opened
horizontally instead.
:call RunAssocSpec()If your current buffer contains a file that could possibly have a spec: run the
associated spec in your shell.<br/>
If your current buffer contains a spec file: run that spec in your shell.
These functions are available in all buffers, regardless of whether you are
editing a file within a Rails project (this may change in the future).
Vim will echo an error when attempting to execute RunAssocSpec() for file types
that do not have specs (in Rails projects).
Setting up Custom mappings
Add leader-key mappings to your vimrc file.
map <Leader>v :call Vspec()<CR>
map <Leader>h :call Hspec()<CR>
map <Leader>t :call RunAssocSpec()<CR>