Ⅰ. 插件描述
Brace yourself, it's time to toggle your ruby blocks!Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'jgdavey/blockle-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'jgdavey/blockle-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'jgdavey/blockle-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/jgdavey/vim-blockle
Ⅳ. 文档说明
This plugin allows rapid toggling between the two different styles of ruby
blocks, namely do/end and brackets {}. To use, simply move the cursor to the
beginning or end of a block, and type <Leader>b. As a mnemonic, remember 'b'
for 'block'.
Note: This plugin works best if you have your cursor on a do, end, {, or }. An
attempt is made for it to work if you are inside a block as well, in which
case the most immediate parent will be toggled.
When moving from a do/end to a bracket-style block, the plugin will attempt to
move to a one-liner if appropriate.
For example, if you have the following ruby code (* indicates cursor position):
['one', 'two'].each d*o |number|
puts number + "!"
end
After invoking <Leader>b, the resulting code would be:
['one', 'two'].each *{ |number| puts number + "!" }
Installation
If you don't have a preferred installation method, I recommend
installing pathogen.vim, and
then simply copy and paste:
cd ~/.vim/bundle
git clone git://github.com/jgdavey/vim-blockle.git
Once help tags have been generated, you can view the manual with:help blockle.
Requirements
This plugin is only available if 'compatible' is not set, and will only work
correctly if matchit.vim is available.
Needs vim 7.4 to work.
License
Copyright (c) Joshua Davey. Distributed under the same terms as Vim itself.
See :help license.