vimhighlight

Vim clear last search highlighting


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?


Solution

  • 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>