Friday, April 30, 2010

Syntax - Highlight TODO w/ Matchgroup

I'm trying to highlight "org-mode" files similar to what's shown here:
http://orgmode.org/img/tasks.png

I found a good start by using "outline.vim" from vim.org.

Now, I'm having problems highlighting the TODO keyword
in a different color than the color of the header.

Example:

* TODO Something

The TODO above should be higlighted differently than the other items
in that line.

Here's what I have so far:
--------------------
syn region Outline_1 matchgroup=Outline_1_match contains=Todo transparent
\ start='^\*.*'
\ end='\n\ze\n\?\*[^*]\|^<$'
\ fold keepend

syn keyword Todo TODO contained

hi! default link Outline_1_match Comment
hi! default link Outline_1 Text
---------------------
I need "matchgroup"since I want to highlight the top TODO
line, but nothing else in that paragraph.

Also, the folding works great.

I think that the "transparent" option is really close to what I want,
because the documentation says

:h syn-matchgroup

In a start or end pattern that is highlighted with "matchgroup" the
contained items of the region are not used. This can be used to avoid
that a contained item matches in the start or end pattern match. When
using "transparent", this does not apply to a start or end pattern
match that is highlighted with "matchgroup".

However, no matter what I've tried, the * TODO Something is always shown
with just the Comment syntax.

Any ideas?

Thanks,
--Nate

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

No comments:

Post a Comment