Thursday, July 17, 2014

Re: syntax region start and end patterns: "inherit" group above?

Ben Klein wrote:
> I have a syntax region where I want the start and end patterns to
> basically be ignored, highlighting-wise. Thus e.g. if I have an
> expression marked with ${}, and what is *contained* in the ${} should
> be highlighted, but the ${} is within a pair of quotes, the ${}
> characters should be highlighted as the quotes and the text in them is
> highlighted.
>
> "This is text with ${foo} in the middle of it."
>
> foo should be highlighted one way, and "This is text with ${", and "}
> in the middle of it" should be highlighted another way.
>
> How can I do this? I tried setting a matchgroup and also tried setting
> it to NONE, but either way it is not highlighted, whereas I'd like to
> have it "inherit" the highlighting of the "" text.
>
>
In your start and end patterns, use \zs and \ze appropriately.

:he /\zs
:he /\ze

Regards,
Chip Campbell

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: