Ⅰ. 插件描述
Add / subtract alternatives to / from the search pattern.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/searchalternatives'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/searchalternatives'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/searchalternatives'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/SearchAlternatives
Ⅳ. 文档说明
DESCRIPTION
This plugin provides mappings and commands to add and subtract alternative
branches to the current search pattern. Currently searching for "foo," but
also want to find matches for "bar"? You could type /foo|bar<CR> or
/<C-R>/|bar<CR>, but once you want to limit the search to whole <words>
(like the star command), and juggle several alternatives, adding and
dropping them as you search, this plugin is quicker than manually editing the
search command-line (which you can still do).
RELATED WORKS
- Add to Word Search (vimscript #3955) can add the keyword under the cursor to
the search pattern and search forward / backward like * / #.
USAGE
<Leader>+ Add the current whole <word> as an alternative to the
search pattern, similar to the star command.
<Leader>g+ Add the current word as an alternative to the search
pattern, similar to the gstar command.
{Visual}<Leader>+ Add the current selection as an alternative to the
search pattern.
For a blockwise-visual selection, each line of the
block (minus leading and trailing whitespace) is added
as a separate alternative search pattern. When the
first selected line of the block is surrounded by non-
keyword characters, the match is done with <...>.
If the blockwise-visual selection is only comprised
of a single line, all WORDs of that line are added as
separate alternative whole <word> search patterns.
<Leader>- Remove the current whole <word> from the alternatives
in the search pattern.
<Leader>g- Remove the current word from the alternatives in the
search pattern.
{Visual}<Leader>- Remove the current selection from the alternatives in
the search pattern.
For a blockwise-visual selection, this has the same
special behavior as {Visual}<Leader>+.
:SearchAdd {expr} Add {expr} as an alternative to the search pattern.
:SearchRemove {expr} Remove {expr} from the alternatives in the search
pattern.
:[N]SearchRemove Remove the [N]'th / last alternative from the
alternatives in the search pattern.