5

After performing some search operation vim highlights its occurrences. These occurrences persist as long as editor is opened or another search is performed.

How to clear previous search highlights after performing some operation?

WitVault
  • 1,699
  • 1
  • 19
  • 27

1 Answers1

10

You can look in the doc at :h nohl:

When there is a previous search pattern, highlight all its matches.

A useful mapping is the following:

nnoremap <C-l> :nohl<CR><C-L>

Originally <C-l> redraw the screen, with this mapping you first clear the highlighting and then redraw the screen.

statox
  • 49,782
  • 19
  • 148
  • 225