Marius Roets wrote:
I am trying to create a syntax file with folding. However after
pouring over the documentation for hours, I seem to be stuck. I want
to, for instance, fold a begin/end block. I have created a simple
syntax file with just this line:
syntax region xBlock start="begin" end="end" transparent
contains=xBlock,xKeyword fold
As expected, this works well. However 'begin' and 'end' are keywords.
..snip..
Hmm, but they're not keywords, at least in the syntax file "with just
one line"
that you provided. If they are keywords, ie. you're involving more syntax,
then: keywords have priority. Consequently, your region will not start.
Priority:
* keywords, later ones have higher priority
* matches and regions, later matches and regions have priority over
other matches and regions.
In effect, regions' start and end patterns are special kinds of matches.
So, let me guess: you want a new syntax line such as
syn keyword xKeyword begin end
because you wish to highlight the words "begin" and "end" differently.
May I suggest using
the "matchgroup" specification: ie.
syn clear
syn region xBlock transparent fold matchgroup=Delimiter start="begin"
end="end" contains=xBlock
Regards,
Chip Campbell