Ⅰ. 插件描述
Punctuation text objects: ci/ da; vi@ yiq daⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'kurkale6ka/vim-pairs'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'kurkale6ka/vim-pairs'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'kurkale6ka/vim-pairs'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/kurkale6ka/vim-pairs
Ⅳ. 文档说明
New punctuation text objects
ci/, di;, yi*, vi@ ...
ca/, da;, ya*, va@ ...
---
ciq (or "") changes content inside ANY kind of quotes
vaq, yiq ...
---
ci<space>, da<space> ... modify ANY punctuation pair
Supported punctuation signs
` " ' ! $ % ^ & * _ - + = : ; @ ~ # | \ , . ? /
Algorithm:
Do in order. If a step succeeds skip the rest.
- _same line_: match under the cursor: act to the right if possible, else to the left
- _same line_: jump to a match on the left, then act to the right if possible or else repeat
- _same line and ↓_: try matching to the right, also past the current line
if no match till EOF, start from byte one and do the same till initial position of cursor
Examples:
[] and | will represent the cursor
ciq or ""
Lorem [] dolor " " adipisicing elit
Lorem dolor "|" adipisicing elitda^ or da<space>
Lorem dolor " ^ [] ^ " adipisicing elit
Lorem dolor " " adipisicing elitvi@ or vi<space>
Lorem dolor @ @ [@] adipisicing elit
Lorem dolor @ @---------@ adipisicing elitNote: the above is different from what Vim would do.
_explanation_: ' ' ['] then ci' WON'T change anything!
di; or di<space>
Lorem % % [] ; ; elit
Lorem % % ;; elitgUiq
Lorem dolor ' val ` X ' orem ` adipisicing elit
Lorem dolor ' val ` X ' OREM ` adipisicing elityi. or yi<space>
Lorem dolor sit amet [] adipisicing elit
incididunt ut labore .dolore. aliqua
Now: dolore is in reg """
START OF FILE
Lorem dolor ' sit amet ' adipisicing elit
incididunt ut labore et dolore [] magna aliqua.
EOF_Result after searching for a match and wrapping around EOF_:
START OF FILE
Lorem dolor '|' adipisicing elit
incididunt ut labore et dolore [] magna aliqua.
EOF