Ⅰ. 插件描述
Vim's missing searchⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'mtth/locate-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'mtth/locate-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'mtth/locate-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/mtth/locate.vim
Ⅳ. 文档说明
.. default-role:: code
Locate.vim
.. image:: doc/locate.png
:align: center
/ and ? are search motions: simple and powerful. But when searching for a
common pattern, especially in a large file, it can be hard to get to the one
match you're looking for (tired of hitting n?). They also don't provide an
overview of where the matches are: the only way to figure it out is to move the
cursor.
Vim comes with alternate commands for this use-case (see :help vimgrep or :help ilist), but they all require manual work (refreshing the list of
results, no highlighting, etc.). :Locate, or :L for short, handles all this
and more.
Features
- Window specific highlighting!
- Automatic sizing, sorting and refreshing of results.
- Quick search for current selection / word under cursor.
- Customizable smartcase_ and
very magic_ modes.
Quickstart
:L foobarsearches for "foobar" inside the current window (short for:Locate foobar). Matches in the current window will be highlighted.glsearches for the word under the cursor (normal mode) or the current
selection (visual mode).:Lpurgecloses the results list and cancels highlighting (can also be done
via:lclose).
After each new search the cursor will jump to the location list and remember
its position inside the searched window (this can be configured with the g:locate_focus and g:locate_jump_to options respectively). The list of
results will stay updated on save. There are more commands and configuration
options which you can read about by running :help Locate.
Installation
With pathogen.vim_:
.. code:: bash
$ cd ~/.vim/bundle
$ git clone https://github.com/mtth/locate.vim
Otherwise simply copy the folders into your .vim directory.
.. _smartcase: http://vimdoc.sourceforge.net/htmldoc/options.html#'smartcase'
.. _very magic: http://vimdoc.sourceforge.net/htmldoc/pattern.html#/magic
.. _pathogen.vim: https://github.com/tpope/vim-pathogen