1

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

iamnotsam
  • 9,470
  • 7
  • 33
  • 30
  • yes, I believe so. I searched for e by accident trying to create panels. This was last week. It is all a blur, I think I was thrashing around trying things. That's when it seemed to happen. – iamnotsam Apr 28 '14 at 17:12
  • You must have searched for `e.`. You can always just search for something new (like `alsdkfjsaldkfj`) to change your most recent search term. Better yet, check out the answers below that show you how to clear your most recent search term... – jahroy Apr 28 '14 at 17:29

3 Answers3

1

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.

ArjunShankar
  • 23,020
  • 5
  • 61
  • 83
1

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

heijp06
  • 11,558
  • 1
  • 40
  • 60
0

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

Community
  • 1
  • 1
iamnotsam
  • 9,470
  • 7
  • 33
  • 30