Vim clear last search highlighting

Gabriel Solomon picture Gabriel Solomon · Mar 18, 2009 · Viewed 519.8k times · Source

After doing a search in Vim, I get all the occurrences highlighted. How can I disable that? I now do another search for something gibberish that can't be found.

Is there a way to just temporarily disable the highlight and then re-enable it when needed again?

Answer

Mykola Golubyev picture Mykola Golubyev · Mar 18, 2009

To turn off highlighting until the next search:

:noh

Or turn off highlighting completely:

set nohlsearch

Or, to toggle it:

set hlsearch!

nnoremap <F3> :set hlsearch!<CR>