tags:

views:

758

answers:

4

When using VIM is there a way that :grep or :vimgrep will color the patterns returned to the buffer?

Thanks!

A: 

You can use the Unix grep:

:!grep --color pattern %

There may be other solutions using internal grep/vimgrep but this one works for me.

Taurus Olson
A: 

Maybe ack fits your bill?

A: 

If you search for the pattern after you've :vimgrep'd it, Vim will highlight it. Just edit the :vimgrep pattern files into :g/pattern/.

For a richer solution, try this script.

George V. Reilly
A: 

Two ways:

  • For normal search / you can use :set hls.
  • Or you can use :match Search /pattern/. This will hightlight everything that matches pattern.
Peter Stuifzand