Friday, March 2, 2012

Re: creating syntax file - syn match problem

On Thu, 1 Mar 2012 17:28:33 -0800 (PST)
Ben Fritz <fritzophrenic@gmail.com> wrote:

>
>
>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.
>>
>> [...]


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

Ben, this works a treat for the examples I posted last night - many
thanks.


However, I just realized the code blocks are a little more complex than
I thought:

a) one-line/inline code blocks are delimited by a set of 3 curly
braces.
b) multi-line blocks
- are delimited by any number of braces (min 3)
- the code may contain sets of curly braces (they don't need to match)
- the block is closed by the first set of braces that contains the same
number of braces as the opening set
- the first code line must be on a new line (not on the same line as
the opening braces)

EXAMPLE:
========

an inline {{{code}}} example

{{{
a block code
}}}


blah {{{{
{{{a block code}}}
}}}}

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