Ⅰ. 插件描述
Start a * or # search from a visual blockⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'bronson/star-search'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'bronson/star-search'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'bronson/star-search'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/bronson/vim-visual-star-search
Ⅳ. 文档说明
## Visual Star Search
File Search
This plugin allows you to select some text using Vim's visual mode, then hit *
and # to search for it elsewhere in the file. For example, hit V, select
a strange sequence of characters like "$! $!", and hit star. You'll find
all other runs of "$! $!" in the file.
By default, when you hit star while making a visual selection, vim extends the
selection to the next word that matches the word under the cursor.
Recursive Search
If you hit <leader>*
(\*
unless you changed the mapleader), vim
recursively vimgreps for the word under the cursor or the visual selection.
If you have already mapped <leader>*
then visual star search won't override it.
This is useful to set up your own search bindings. For example, to get
visual-star-search to use Ag instead of vimgrep, add
these two lines
to your .vimrc.
History
It was originally derived from
a post on Scrooloose's Blog.
Alternatives
- visualstar
- vsearch
-- Godlygeek's file probably came from the same source and is looking great. - nelstrom's fork made some excellent changes. As of Oct 2014, they've been incorporated into this script.