Ad hoc text highlighting in vim
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 so开发者_开发百科mething 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.
The command Vim has available for that is :match. You can also use the matchadd() function to add an arbitrary number of matches.
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
I use the MultipleSearch plugin exactly for this.
精彩评论