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?


1 Answer 1


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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.