vim-close-pair


Ⅰ. 插件描述

A Vim plugin to find last opening brace and insert corresponding closing brace

Ⅱ. 基本信息

创建日期:  2015-07-19
使用用户:  2
Github星:  3
插件作者:  Tran Van Sang

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/tranvansang/vim-close-pair

Ⅳ. 文档说明

Vim Close Pair

A Vim plugin to find last opening brace and insert corresponding closing brace

Install

  • With Vundle

    • Append Plugin ‘tranvansang/vim-close-pair’ to your .vimrc
    • Restart vim or run :source ~/.vimrc
    • Run :PluginInstall
  • Manual

    git checkout https://github.com/tranvansang/vim-close-pair.git
    cd vim-close-pair
    mkdir -p ~/.vim/plugin
    cp -f plugin/close-pair.vim ~/.vim/plugin/
    mkdir -p ~/.vim/autoload
    cp -f autoload/close-pair.vim ~/.vim/autoload/
    

Usage

In insert mode, type Ctrl-L

  • Text : ({[ [foo] bar (foo) bar
  • Result : ({[ [foo] bar (foo) bar]

Options

Set values here are the default

  • Binding key. Becareful when set this option, because it is bound it insert mode and may caught trouble when typing.

    Set empty(’’) to disable this plugin

    let g:close_pair_key = ‘<C-L>’
  • Maximal number of lines to scan for opening braces.

    Set 0 to disable this plugin, -1 for unlimit (scan until first line)

    This option is combined with g:close_pair_characters_limit.

    Scanning will stop when any of both limits reached.

    let g:close_pair_lines_limit = -1
  • Maximal number of characters to scan.

    Set 0 to disable this plugin, -1 for unlimit (scan until first character in buffer)

    This option is combined with g:close_pair_lines_limit.

    Scanning will stop when any of both limits reached.

    let g:close_pair_characters_limit = -1
  • Just move cursor right if the closing brace is already inserted

    let g:close_pair_ignore_if_matched = 1
Example:

- Text  : `(|)` (`|`: cursor position)
- Result :
    - When this option is enabled: `()|`
    - When this options is disabled: `()|)`

NOTE

  • This plugin parses only pairs in matchpairs option.
  • For HTML tag, you should use system completion (<C-x><C-o>) for better effect.

    Example:

    • Text : <header>foo</| (| : cursor position)
    • Type : <C-x><C-o>
    • Result : <header>foo</header>|

添加新评论