that works well - i couldn't quite figure out what the 'contains' and
'contained' keywords were for just from the help files, so thanks much :)
thanks also for the tip about the naming convention - i've amended my syntax
file accordingly.
A.J.Mechelynck wrote:
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, @x, 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.
--
View this message in context:
http://www.nabble.com/syntax---multiple-colors-in-same-string-tf3653839.html#a10218189
Sent from the Vim - General mailing list archive at Nabble.com.