Ⅰ. 插件描述
A Vim plugin providing text objects for the closest pairs of quotes of any typeⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'beloglazov/vim-textobj-quotes'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'beloglazov/vim-textobj-quotes'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'beloglazov/vim-textobj-quotes'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/beloglazov/vim-textobj-quotes
Ⅳ. 文档说明
# vim-textobj-quotes
vim-textobj-quotes is a Vim plugin providing text objects for the closest
pairs of quotes of any type. Using only iq or aq it allows you to operate on
content of single ('), double ("), or back (`) quotes that currently surround
the cursor, are in front of the cursor, or behind (in that order of preference).
In other words, it jumps forward or backwards when needed to reach the quotes.
It's easier to understand by looking at examples (the cursor is shown with |):
- Before:
foo '1, |2, 3' bar; after pressingdiq:foo '|' bar - Before:
foo| '1, 2, 3' bar; after pressingdiq:foo '|' bar - Before:
foo '1, 2, 3' |bar; after pressingdiq:foo '|' bar - Before:
foo '1, |2, 3' bar; after pressingdaq:foo | bar - Before:
foo| '1, 2, 3' bar; after pressingdaq:foo | bar - Before:
foo '1, 2, 3' |bar; after pressingdaq:foo | bar
The examples above are given for single quotes, the plugin works exactly the
same way for double (") and back (`) quotes.
At the moment, the plugin has experimental support for multiline and nested
quote structures, please report any bugs in the [issue
tracker](https://github.com/beloglazov/vim-textobj-quotes/issues).
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-quotes'Then run :BundleInstall to install the plugins.
Configuration
As most of the time, you need to operate on a text inside quotes, I add the
following binding to make it even more convenient to use:
xmap q iq
omap q iqNow, you just need to press cq, dq, yq, or vq to operate on the text in
single ('), double ("), or back (`) quotes nearby without manually moving into
them.
Enjoy! :)
License
Copyright (c) Anton Beloglazov. Distributed under the same terms as Vim itself.
See :help license.