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?
Highlighting search matches To highlight all search matches, set the following option: :set hlsearch. With the defaults, setting this option causes all text matching the current search to be highlighted using the Search highlight group, which adds a yellow background to the current highlighting.
You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With