mtth / locate.vim

Vim's missing search
28 stars 3 forks source link
search 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

Quickstart

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