Alex Rivera | Logout

How do you make Vim unhighlight what you searched for?

Asked 2008-09-19T03:05:24.980
269

I search for "nurple" in a file. I found it, great. But now, every occurrence of "nurple" is rendered in sick black on yellow. Forever.

Forever, that is, until I search for something I know won't be found, such as "asdhfalsdflajdflakjdf" simply so it clears the previous search highlighting.

Can't I just hit a magic key to kill the highlights when I'm done searching?

Edit
Report

1 Answer

205

Just put this in your .vimrc

" <Ctrl-l> redraws the screen and removes any search highlighting.
nnoremap <silent> <C-l> :nohl<CR><C-l>
answered 2008-09-19T03:09:27.730

Your Answer