On Sun, Dec 17, 2017 at 7:02 PM, Tim Chase <vim@tim.thechases.com> wrote:
> On 2017-12-17 18:49, Jorge Almeida wrote:
>> I need to apply custom highligthing in a setup that should be simple
>> for people who understand highligthing:
>>
>> I have a bunch of keywords with a common prefix, the single
>> character 'c'. The keywords are to be listed one by one, not
>> obtained via some algorithm. Example:
>>
>> cmount
>> cumount
>> copen
>> cclose
>> (etc)
>>
>> So, I want to highlight these keywords, *minus the prefix*, with
>> some colour (say, the same colour for all keywords). That is, in
>> "cmount", only "mount" should be coloured, not the leading 'c'.
>
> Does
>
> :match Error /\%(\<c\)\@<=\w\+/
>
> give you what you're looking for? Alternatively, if they're a fixed
> list of keywords, you can join them together something like
>
> :match Error /\%(\<c\)\@<=\(mount\|umount\|open\|close\)/
>
Indeed it does! (Well, the latter suggestion does.)
I did this:
highlight macro_skin guibg=bg guifg=DarkGreen gui=bold ctermfg=022 cterm=bold
match macro_skin /\%(\<c\)\@<=\(mount\|umount\|open\|close\)/
And that's it. (And just a few minutes after posting, to boot!)
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.
Thanks
Jorge
--
--
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