Highlighting a search term without moving the cursor

highlightingsearchvim

Using Vim, I sometimes find myself staring at a section of source code for a while and suddenly want some variable on the screen to pop out. That's easy: /<var> which highlights them all. My issue is that it more often than not the search shifts my window so I'm not looking at the source code from the same place. Even if it's only shifted a few lines, it's still throws me off since I need to take a few seconds to figure out where things have moved to.

Is it possible to highlight a search term without moving the cursor to the next match?

Best Answer

http://vim.wikia.com/wiki/VimTip1572

If you used this plugin, you can simply enable the functionality

\m

then use a NumPad key to assign a colour to that word everywhere without moving your cursor.

1

You can use many different highlights at once for many different words, or more complex search patterns if you wish.

Related Question