Ⅰ. 插件描述
A textobject plugin to do well with each delimited part of a string.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'machakann/textobj-delimited'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'machakann/textobj-delimited'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'machakann/textobj-delimited'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/machakann/vim-textobj-delimited
Ⅳ. 文档说明
textobj-delimited
The textobject plugin to do well with each delimited parts of string.
Brief explanation
This textobject provides the keymappings to select a part of a delimited string. id, ad, iD, aD is used in default. Please see following examples and doc/textobj-delimited.txt.
Examples
------------------------------------------------
key input: did
# # : cursor
'foo_bar_baz' -> '_bar_baz'
------------------------------------------------
key input: did
# # : cursor
'foo_bar_baz' -> 'foo__baz'
------------------------------------------------
key input: did
# # : cursor
'foo_bar_baz' -> 'foo_bar_'
------------------------------------------------
key input: d1id
# # : cursor
'foo_bar_baz' -> '_bar_baz'
------------------------------------------------
key input: d2id
# # : cursor
'foo_bar_baz' -> 'foo__baz'
------------------------------------------------
key input: d3id
# # : cursor
'foo_bar_baz' -> 'foo_bar_'
------------------------------------------------
key input: dad
# # : cursor
'foo_bar_baz' -> 'bar_baz'
------------------------------------------------
key input: dad
# # : cursor
'foo_bar_baz' -> 'foo_baz'
------------------------------------------------
key input: dad
# # : cursor
'foo_bar_baz' -> 'foo_bar'
------------------------------------------------
key input: d1ad
# # : cursor
'foo_bar_baz' -> 'bar_baz'
------------------------------------------------
key input: d2ad
# # : cursor
'foo_bar_baz' -> 'foo_baz'
------------------------------------------------
key input: d3ad
# # : cursor
'foo_bar_baz' -> 'foo_bar'
------------------------------------------------When delimited parts are being selected in visual mode, this textobject behave differently from usual, expanding selection area like viwiwiw...
Assume the situation as following:
|<-->| : selected area
abcdef_ghijkl_mnopqrIf you use id, then you will get:
|<--------->| : selected area
abcdef_ghijkl_mnopqrIf you use iD, then you will get:
|<--------->| : selected area
abcdef_ghijkl_mnopqrAt the beginning of a word, ad and aD work tricky. Look the following examples.
If you use dad, the cut strings are different for '_abc_def_ghi_' and 'abc_def_ghi'.
# # : cursor
_abc_def_ghi_ -> _def_ghi_ (cut '_abc')
# # : cursor
abc_def_ghi -> def_ghi (cut 'abc_')Thus, if a word has ended delimiters like '_abc_def_ghi_', ended delimiters would be preserved. If a word has no ended delimiters like 'abc_def_ghi', ended delimiters would not appear. dad keeps the exsistence/nonexistence of ended delimiters.