Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I have these Vim definitions:

syn match tasktag "\(\s\)\@<=@[a-zA-Z0-9_]\+"
syn match taskdone "\<[Dd]one\>" containedin=tasktag

How do I specify taskdone to highlight the entire text in the line? I looked at :h syn-pattern-offset as well as :h syn-region.

share|improve this question

First, your "tasktag" match does not allow spaces or other "word delimiters", yet your "taskdone" match requires "done" to be a discrete word because of your \< and \> word boundary atoms.

Second, your "taskdone" match is written to only highlight the word "Done".

Assuming I properly understand what you want, I modified your two matches:

syn match tasktag "\(\s\)\@<=@[a-zA-Z0-9_ ]\+"
syn match taskdone "@.*\<[Dd]one\>.*" containedin=tasktag

If you haven't done so already, you will need to specify the highlighting for the two matches. For example:

highlight link tasktag TODO
highlight link taskdone Statement
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.