Ⅰ. 插件描述
endwise.vim: wisely add "end" in ruby, endfunction/endif/more in vim script, etcⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'tpope/endwise-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'tpope/endwise-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'tpope/endwise-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/tpope/vim-endwise
Ⅳ. 文档说明
# endwise.vim
This is a simple plugin that helps to end certain structures
- In Ruby, this means adding
end
afterif
,do
,def
- several other keywords. In Vimscript, this amounts to appropriately
adding endfunction
, endif
, etc. There's also Bourne shell, Z shell,
VB (don't ask), C/C++ preprocessor, Lua, Elixir, Haskell, Objective-C,
Matlab, Crystal, Make, Verilog and Jinja templates support.
A primary guiding principle in designing this plugin was that an
erroneous insertion is never acceptable. The behavior is only triggered
once pressing enter on the end of the line. When this happens, endwise
searches for a matching end structure and only adds one if none is
found.
While the goal was to make it customizable, this turned out to be a tall
- Every language has vastly different requirements. Nonetheless,
- those bold enough to attempt it, you can follow the model of the
autocmds in the plugin to set the three magic variables governing
endwise's behavior.
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/tpope/vim-endwise.git
Self-Promotion
Like endwise.vim? Follow the repository on
GitHub and vote for it on
vim.org. And if
you're feeling especially charitable, follow tpope on
Twitter and
GitHub.
License
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
See :help license
.