tags:

views:

72

answers:

3

I'm doing a lot of digging around in log files these days, which usually involves tracking a certain identifier through various places in the log file. If I search for the identifier, then vim highlights all the occurrences, which really helps in the digging, but it disappears if I search for something else.

Is there a quick way to get vim to highlight, e.g., change the background or color, of text matching a certain regular expression?

I suppose syntax highlighting is sort of what I want, but it would be nice if there was a more dynamic way.

+5  A: 

The command Vim has available for that is :match. You can also use the matchadd() function to add an arbitrary number of matches.

jamessan
Thanks for the help!
David Norman
+1  A: 

I use the plugin mark.vim to visually mark words. It allows to mark different words in different colors simultaneously and jump to the occurrences. In my opinion this feature is very helpful, especially for code analyses - or for stepping through logging files.

mark.vim

Habi
A: 

I use the MultipleSearch plugin exactly for this.