Ⅰ. 插件描述
Auto closes pairs of charactersⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/closepairs'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/closepairs'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/closepairs'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/ClosePairs
Ⅳ. 文档说明
Autocloses pairs of chararacters as seen in TextMate or Scribes.
I couldn't find a script that worked as I liked, so here's my very simple attempt :)
Pairs are (), [], {}, '', ""
Features
1) in INSERT mode, typing the closing character let the cursor "escape" the pair
e.g.: (cursor represented with a pipe, on the left what you type, on the right what you get)
" -> "|"
some text -> "some text|"
" -> "some text"|
- useful when typing an open/close bracket pair as in foo()
- works with already existing text
e.g.:
(move cursor) -> "this is a string|"
" -> "this is a string"|
2) "atomic" deletion of a pair
()|<bs> -> |
(|)<bs> -> |
- won't work with
(usewhen you don't want the closing bracket/quote)
3) experimental support for visual mode
select abc
type <leader>" -> "abc"
tested with vim 7; might work with earlier versions, though
hope you'll like it, let me know!
you can comment here: http://www.flatpress.org/home/?entry=entry080910-135006
UPDATE: since you made me notice, here's the other scripts dealing with the same problem
- vimscript #1849 - AutoClose by Karl Guertin
- vimscript #2009 - AutoClose by Thiago Alvares
they all differs for little, the first is a bit simpler; the latter is probably the most configurable.
Pick your favorite :)