Question

In any type of file edited with VIM, I am seeing an unwanted pattern highlighted everywhere and I don't know how to turn just that pattern off. Or perhaps I corrupted a file accidentally. It seems like this happened recently after my thrashing around, experimenting with multiple windows (red herring?).

The pattern seems to be: the letter e plus one character of any kind ("eg", "el", "e.", etc)

Highlighting of e plus any character

Was it helpful?

Solution

To clear the highlight where text matches the last search pattern type :nohls

OTHER TIPS

It is probably the last thing you searched for. vim remembers it across restarts.

I keep this handy mapping in my ~/.vimrc:

nnoremap \ :let @/ = ""<CR>

Then, I can use type \ while in COMMAND mode in vim, and it clears the last search term.

I used to earlier use this:

nnoremap \ :set hlsearch!<CR>

This basically toggles search highlighting on/off when you hit \, but keeps the last search term in the @/ register.

For a permanent solution you can use something like ArjunShankar suggested. For a "fix just this time" I found this. The reason I couldn't find this initially was I didn't realize that when something is highlighted in VIM, it can be related to your last search.

:let @/ = ""

This was found via this thread: Vim clear last search highlighting

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top