Ⅰ. 插件描述
A Vim text object from the cursor position to the closest punctuation in frontⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'beloglazov/vim-textobj-punctuation'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'beloglazov/vim-textobj-punctuation'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'beloglazov/vim-textobj-punctuation'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/beloglazov/vim-textobj-punctuation
Ⅳ. 文档说明
# vim-textobj-punctuation
vim-textobj-punctuation is a Vim plugin providing text objects iu and au
(u stands for pUnctuation, as p is already taken for paragraphs) for
capturing the text between the current cursor position and a punctuation
character in front. This punctuation character can be one of: ,, ., :,;, !, and ?. The text object can span multiple lines to reach the closest
punctuation character. Some examples (the cursor is shown with |):
- Before:
String |foo = "bar";; after pressingdiu:String |; - Before:
if |i == 42:; after pressingdiu:if |: - Before:
Vim is |a nice editor!; after pressingciuthe best editor ever:
Vim is the best editor ever!
Installation
This plugin requires
vim-textobj-user to be installed. If
you are using Vundle, just add the following lines to your .vimrc:
Bundle 'kana/vim-textobj-user'
Bundle 'beloglazov/vim-textobj-punctuation'Then run :BundleInstall to install the plugins.
Configuration
As most of the time, you need to operate on the text until punctuation, I add
the following bindings to make it even more convenient to use:
xmap u iu
omap u iuNow, you just need to press cu, du, yu, or vu to operate on the text
until the closest punctuation.
Enjoy! :)
License
Copyright (c) Anton Beloglazov. Distributed under the same terms as Vim itself.
See :help license.