Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In VIM, how can I search for multiple strings and have a different color highlight for each match?

share|improve this question
Maybe this helps you: stackoverflow.com/questions/9075387/… – Bernhard Feb 24 '12 at 9:47

There is MultipleSearch plugin for vim. Description:

MultipleSearch allows you to have the results of multiple searches displayed on the screen at the same time. Each search highlights its results in a different color, and all searches are displayed at once. After the maximum number of colors is used, the script starts over with the first color.

share|improve this answer

You can use this matching commands...

:sy[ntax] match {group-name} [{options}] [excludenl] {pattern} [{options}]

if you wants to search and highlight Apple with Red color and Mango with Green and Grape with Blue use this:

:highlight col1 guibg=Red guifg=White
:syntax match col1 /Apple/
:highlight col2 guibg=Green guifg=Black
:syntax match col2 /Mango/
:highlight col3 guibg=Blue guifg=White
:syntax match col3 /Grape/
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.