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?
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>
From the VIM Documentation
To clear the last used search pattern:
:let @/ = ""
This will not set the pattern to an empty string, because that would match everywhere. The pattern is really cleared, like when starting Vim.
You can do
:noh
or :nohlsearch
to temporarily disable search highlighting until the next search.
下一篇: Vim清除上次搜索高亮显示