Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of search highlight in Vim

Tags:

vim

I have :set hlsearch as default value.

When I search for something, search terms get highlighted. However many times I want to get rid of the highlight, so I do :set nohlsearch. In this way I get rid of highlights for the time being.

However if I do a new search, then search terms are not highlighted.

I would like to hit ESC + ESC to get rid of highlights and then set back :set hlsearch.

Any suggestions?

like image 379
Roger Avatar asked Aug 29 '09 20:08

Roger


People also ask

Why is text highlighted in vi?

Its most likely because you are visual select mode (which you get to by pressing the 'v' key in command mode). Try pressing Esc twice to see if that gets you out of it. Another clue on this would be that it would say -- VISUAL -- in the status line.

How do I change the highlight color in VIM?

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.


2 Answers

Try the :noh command.

vi/vim notes

like image 114
Michael Krelin - hacker Avatar answered Oct 04 '22 14:10

Michael Krelin - hacker


I use

/pleasedisablehighlightthanks 

command. Or just

/qewrufhiqwe 

But you should be carefult not to mix this with the following command!

/qewrufhiqew 
like image 39
P Shved Avatar answered Oct 04 '22 14:10

P Shved