Gene Kwiecinski wrote:
when i do a search like  /text
it highlights all of the matches and i can use n and N to navigate.
how do i turn the highlighting off when i am done?

Need to keep the pattern in memory?  If not, "/zzz" will do it, assuming
you don't have "zzz" anywhere else in your file, of course.

Can fiddle with ":set nohls" and whatnot, but for me, it's just easier
to search for nothing to turn off highlighting of the just-searched-for
text.

Then, of course, you'd have to ":set hls" to turn it back on again.
Lotta typing, big pain, 'swhy I don't do that, and just search for
gibberish instead if I want to unhighlight what I was just looking for.
The search register can be overwritten by setting @/ to ''. This then clears your search "properly".

For my purposes, I have the following mapping in my vimrc:

nnoremap <silent> <M-/> :set @/=''<CR>

so pressing alt-/ then clears my search.

--
Albie Janse van Rensburg

It is only by risking our persons from one hour to another that we live at all. And often enough our faith beforehand in an uncertified result is the only thing that makes the result come true. -- William James

Reply via email to