Sunday, December 17, 2017

Re: highlighting prefixed keywords

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\)/

You can adjust the color group to something other than Error, as
that's just what I chose by default.

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

Post a Comment