Luis
Luis

Reputation: 1828

How to color my vimgrep result patterns

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

Upvotes: 10

Views: 4039

Answers (4)

Peter Stuifzand
Peter Stuifzand

Reputation: 5104

Two ways:

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

Upvotes: 0

George V. Reilly
George V. Reilly

Reputation: 16313

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.

Upvotes: 4

user55400
user55400

Reputation: 4029

Maybe ack fits your bill?

Upvotes: 0

Taurus Olson
Taurus Olson

Reputation: 3161

You can use the Unix grep:

:!grep --color pattern %

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

Upvotes: 2

Related Questions