Sunday, December 17, 2017

Re: highlighting prefixed keywords

On 2017-12-17 19:16, Jorge Almeida wrote:
> Just a detail: is it possible to enumerate the keywords in a
> separate declaration, to improve maintainability? (The actual list
> is more extense). I'm thinking of something similar to:
>
> syntax keyword Foo open close mount umount
>
> Even if it's not possible, this is good enough.

Also, one might use

syn match jaKeyword /\<c\%(umount\|mount\|open\|close\)/hs=s+1
hi def link jaKeyword Identifier

which simplifies the syntax a bit.

Despite multiple attempts, I was unable to get it to work with
syn-keyword as it seems to want a Word boundary between the /\<c/ and
the keyword. I tried

syn region jaKeywordRegion start='\<c'rs=s+1 end='\>' contains=jaKeyword transparent
"syn keyword jaKeyword contained umount mount open close
syn match jaKeyword contained /umount\|mount\|open\|close/
hi def link jaKeyword Identifier

and it worked fine with the "match" version but failed with the
"keyword" version. I also tried various configurations of ms= and
rs= offsets to no avail.

-tim



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