Ⅰ. 插件描述
Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'svermeulen/vim-next-object'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'svermeulen/vim-next-object'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'svermeulen/vim-next-object'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/svermeulen/vim-next-object
Ⅳ. 文档说明
Next Text Object Vim Plugin
This Vim plugin allows you to search forwards or backwards text objects rather than requiring that you be inside them. It is based on a function from Steve Losh's vimrc, with some modifications.
The plugin by default uses the letters 'n', 'l' and maps <C-l> and <C-h>. This can be configured.
Works for the following text objects:
(, [, {, ', "
In conjunction with operators, allows to make commands as:
- din( -> delete inside next pair of bracket
- dil} -> delete inside previous pair of brackets
- dal" -> delete around previous string
Features
Operate in next/previous text object
Original text ('|' represents cursor position in normal mode):|foo = bar('span')
Input keys:foo = bar
Result:foo = bar('|')
Select around previously used object
Original text (after using 'in{' text objec text objectt):fun1()
{# text}
|
fun2()
{# text}
Input key 1:<C-h>
Result 1 (▒ means start and end of selection):fun1()
{▒# text▒}
fun2()
{# text}
Input key 2:<C-l>
Result 2;fun1()
{# text}
fun2()
{▒# text▒}
Installation
Download repository and copy every in the corresponding folders or just use a plugin manager as:
Vundle:
Add to your .vimrc:
Plugin 'saulaxel/vim-next-object'
Plug:
Add to your .vimrc:
Plug 'saulaxel/vim-next-object'
Configuration
- Change next/previous shortcuts
let g:next_object_next_letter = 'n'
let g:next_object_prev_letter = 'p' - Change shortcuts for selecting previously used objects
let g:next_object_select_next = "<C-l>"
let g:next_object_select_prev = "<C-h>" - Let the functions wrap the file
let g:next_object_wrap_file = 1