subrama6 wrote:
i'm somewhat new to vim, and particularly new to making my own syntax file,
so please forgive me if this is a dumb question :)  basically, i'm using vim
to keep a GTD style todo list, with various tasks tagged by context.  the
format of the file is as follows:

  @vim @syntax : learn how to do write vim syntax files
  @vim @motions : learn more about motions
  @shopping @grocery : pick up bread on the way home
...etc

these are all indented two spaces so that folding by indent works well for
the various headings i've made.  i've made a syntax file that does *almost*
everything i want it to.  the only thing i can't seem to get work is to get
the tag identfier, namely "@", to be a different, but specified, color than
the text following it.

here's what i mean.

in the syntax file, i have something similar to the following

syn match tag /\s@/
highlight link tag Special

this makes the whole thing, "@xxxxx", appear highlighted as Special.  what
i'd like to do, though, is have the @ be one color and the rest of the tag
be another - Error, for example.  I've tried the following:

syn match tagtext /@[a-z]*/s+1
highlight link tagtext Error

if the statements from above are in there, these lines appear not to make
any difference.  if they are not, the whole string gets highlighted as
Error.  I've tried multiple kinds of regexes, but it seems to me that when
there are two that both have to do with the "@", they seem to be clobbering
each other.

Any suggestions?

What about

        syn match mysyntaxTag /\<@\a*\>/ contains=mysyntaxTagIdent
        syn match mysyntaxTagIdent /@/ contained
        hi default link mysyntaxTag Identifier
        hi default link mysyntaxTagIdent PreProc

Note that by convention, any syntax groups that you create should start by the name (in lowercase) of the syntax script that created them; then comes the rest of the name (starting with a capital). This is meant to avoid clashes between scripts for different syntaxes. This convention is obeyed by any syntax script accepted in the main distribution, such as the "conaryrecipe" syntax currently being discussed on vim-dev.


Best regards,
Tony.
--
Government lies, and newspapers lie, but in a democracy they are
different lies.

Reply via email to