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


2 Answers 2


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.


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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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