Home

Awesome

Localsearch - Window local searching in Vim

What will it do?

Turn on Localsearch, search one thing in one window, switch to another window and search for something else. Switch back and forth and the searchterm is updated to the one pertaining to the respective window.

Wait, what? Why?

Imagine you want to trace a variable trough a codebase:

How do I use it?

  1. Install it using your favorite plugin manager, e.g. Plug 'mox-mox/vim-localsearch' for vim-plug.
  2. Copy the mappings in :help localsearch-recommended into your .vimrc/init.vim
  3. Open a file, hit <leader>/ to enable localsearch. Open a split, move the cursor over a word and press *. Vim will search for that word as it would without localsearch. Now, move the cursor over another word and press * again. Instead of replacing the search term, Vim will now search for both terms.
  4. Now, move back to the first split window. The search highlighting will disappear. Search for something, then move back to the second window. Your search in the second window will be re-activated. Fancy again!

Vim-Airline integration

I wrote a small extension to vim-airline that will show an indicator in the statusline when localsearch is activated. It should load automatically when you have both plugins installed and look like this: image