Tuesday, April 27, 2010

Re: How to highligh multiple matches?

On Apr 27, 9:19 am, Peter Princz <prin...@gmail.com> wrote:
> Dear vim community,
>
> I have a small issue, it really just bugs me. Could not find it in the
> documentation, maybe the collective wisdom of this list will solve it.
>
> A search pattern of: .*\zsfoo\ze\&.*\zsbar\ze will find all instances where
> "foo" and "bar" are at the same line, in arbitrary order.
> This is OK, but I want them to be highlighted as matches too, both of them.
>

You can't, in this way. A single match can only have a single start
and end. Does it really make sense for a match to start and end in two
different places simultaneously?

You CAN show both these matches in other ways, using the matchadd
function, as shown here:

http://vim.wikia.com/wiki/Highlight_multiple_words

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Subscription settings: http://groups.google.com/group/vim_use/subscribe?hl=en

No comments:

Post a Comment