UPDATE . My previous answer was wrong, you can do it with a scope, just
syn region SubSubtitle start=+=+ end=+=+ oneline
See :help syn-oneline and :help syn-arguments . Guess this shows that I can't start vim right now, hunh?
Previous answer
According to my reading : help syntax , there is no way to do this with scope . However, you can do this with syn-match:
syn match SubSubtitle /=\@<!=[^=]*==\@!/
/ = \ @ <! / says that there is no
= immediately before your match, and
/=\@!/ says that there is no
= immediately afterwards, so this corresponds to exactly one
= , group not
= (not including new lines - to include newlines, this must be
\_[^=] ), and then exactly one
= .
The rest are similar
syn match Subtitle /=\@<!=\{2}[^=]*=\{2}=\@!/ syn match Title /=\@<!=\{3}[^=]*=\{3}=\@!/ syn match MasterTitle /=\@<!=\{4}[^=]*=\{4}=\@!/
You can still play matches in sync matches, so if you have any kind of nesting, it will still work.
for example
syn match Todo /\<TODO\>/ containedin=SubSubtitle,Subtitle,Title,MasterTitle contained
rampion
source share