Le dimanche 01 mars 2015 à 06:36, Mark Volkmann a écrit:
> I wanted to highlight Foo and Bar in the following line:
>
> class Foo extends Bar {
>
> I have this working now using the following:
>
> syntax region javaScriptClassName start=/^class \| class /hs=e+1 end=/ /he=s-1 oneline
> " Can't start the start pattern with a space because javaScriptClassName already consumed it.
> syntax region javaScriptExtendsName start=/extends /hs=e+1 end=/ /he=s-1 oneline
>
> However, I also wanted to treat "class" and "extends" as keywords and highlight those.
> When I do that, my regions above stop working.
> Not sure why I can't have both.
You should use contained groups, e.g.:
syn keyword jsClassKeyword class extends contained
syn match jsClass +^\s*class.\+\ze{+ contains=jsClassKeyword
See ":help syn-contains".
Best,
Paul
--
--
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:
Post a Comment