Thursday, 15 December 2016

How to toggle between highlight search and non highlight search?

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. See :help hl-Search, or type :hi Search to see what color you have it set to. You can easily change the default highlighting with, for example, :hi Search guibg=LightBlue.

To disable the highlighting temporarily, enter (this is a command, not an option):
:nohlsearch
This command (which can be abbreviated to :noh) removes the highlighting for the current search. The highlighting returns for the next search.

Write them into vimrc, if you don't want to set the option each time when you open vim.


More about highlight search, see link:
http://vim.wikia.com/wiki/Highlight_all_search_pattern_matches

No comments:

Post a Comment