Robert Hicks wrote:
Charles E Campbell Jr wrote:
<snip>
Is it possible to create a keyword group and then do a match with
those words and if they are prefixed with a "-" to color them a
certain way? A couple of the actual ones would be:
-command
-menu
-fill
-pady
-padx
-tearoff
-label
-text
-height
-width
-justify
and the list goes on. And you can see why I was hoping a simple
match would do it. :-)
You can get the effect I think you want with:
syn match OptionMatcher "\%(^\|\s\)\zs-\w\+"
contains=SpecificOptionList,OptionStarter
syn keyword SpecificOptionList contained command menu fill pady padx
tearoff label text height width justify
syn match OptionStarter contained "-"
hi link OptionMatcher Error
hi link SpecificOptionList Statement
hi link OptionStarter SpecificOptionList
These commands will highlight your options; ones that aren't in the
keyword list (ex. -junk) would get highlighted as Error.
Well that kind of worked. Every word that start with "-" is
highlighted as an "Error", including those in the "SpecificOptionList".
To test that, I set up two files tmp (with some options contained) and
tmp.vim (with the syntax). I then used :so tmp.vim while
editing tmp. Anyway, the highlighting worked. I suggest first trying
it separately as I did; hopefully you'll see its working.
Were you immediately putting that snippet (with adjusted group names)
into a local copy of syntax/tcl.vim? Then you'll have
to start worrying about priority and interference from and with other
syntax highlighting.
Regards,
Chip Campbell