On Thursday, March 1, 2012 1:41:03 PM UTC-6, Tarlika Elisabeth Schmitz
wrote:
>
> I have created a syntax file for a markup language.
>
> Below I have given examples of inline and multi-line code blocks.
>
> I would like to highlight the text between the set of curly braces and
> highlight the the curly braces in a different colour.
>
> My attempt below doesn't work: it causes the remainder of the document
> to be highlighted in the code xyzCode colour.
>
> Any help with this would be greatly appreciated.
>
> SYNTAX FILE:
> ============
>
> syn match xyzCodeMark contained "{{{"
> syn match xyzCodeMark contained "}}}"
> syn region xyzCode start='{{{'hs=s+3 end='}}}'he=e-3
> contains=xyzCodeMark
>
> hi link xyzCodeMark Function
> hi link xyzCode String
>
>
> This won't work because only one item can match at a given location. The
xyzCodeMark prevents the xyzCode end pattern from matching. This allows
nesting of syntax regions. You can use the "keepend" keyword on the xyzCode
region, but this will disable nesting of that region unless you also use
"extend" where needed.
The better method for this specific case is to use "matchgroup" instead of
creating contained matches for the start and end patterns. :help
:syn-matchgroup.
>
--
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