Ⅰ. 插件描述
Vim text objects for regions inside backticksⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'fvictorio/vim-textobj-backticks'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'fvictorio/vim-textobj-backticks'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'fvictorio/vim-textobj-backticks'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/fvictorio/vim-textobj-backticks
Ⅳ. 文档说明
# textobj-backticks
This plugin provides text objects for blocks inside backticks. You need
to have vim-textobj-user installed
to use it.
Usage
There are three objects provided. Two of them are the obvious ones,
and the third may be useful for some particular cases.
The obvious ones:
a`: All the text inside the backticks, including the backticks.i`: All the text inside the backticks, without the backticks.
The special one:
ii`: All the text inside the backticks, excluding all the space after
- opening backtick and all the space before the closing backtick.
This can be useful, for example, when editing HTML templates inside backticks
in javascript:
var template = `
<div>
Hello world
</div>
`;That way, you can edit the template without having to re-indent.
Caveats
Given the symmetric nature of backticks, there is no (easy) way to know
if you are inside an opening and closing backtick, or if you are inside
a closing and an opening backtick. So, use with caution.
Full disclosure
You can obtain the same basic functionality with
vim-textobj-between. Using
this plugin you just save a keystroke and get the inside-but-without-whitespace
functionality.
Installation
Install vim-textobj-user.
Copy the files to your plugin directory, or use
pathogen.