On Jan 16, 1:51 pm, Silas Silva <[email protected]> wrote:
> Hi all.
>
> I'm facing small problems regarding highlight of regions between XML
> tags.  docbk.vim (that includes xml.vim) syntax file works almost fine
> with DocBook tags, like those:
>
>     <title>bla</title>
>     <emphasis>foo</emphasis>
>
> But, those only work when the highlighted text and the tags (that define
> the region) are in the same line.  So, the following doesn't work:
>
>     <title>
>       bla
>     </title>
>
>     <emphasis>
>       foo
>     </emphasis>
>
> So, since I would like to highlight text between for tag <foo>, I wrote
> my own rules:
>
>     syn region myFoo start='<foo>' end='</foo>' skipwhite keepend
>     hi! def link myFoo Constant
>
> These works for text between <foo> and </foo>, but it also highlights
> the tags.  I thought using offsets (ms=s+1 and me=s-1), but
> fantastically it doesn't work (it colors the whole region, including the
> tags or none of it).  After commenting some code in Vim's xml.vim, I
> discovered that commenting tag definition at line 196 made it work.
>
> Is it possible, in syntax definitions, to make a string not match a
> rule, even if it would match according to regular expressions previously
> defined?
>

You'll need to play with the contains keyword of your group to include
the normal highlighting rules, or the matchgroup keyword. As explained
at :help :syn-priority:

> When several syntax items may match, these rules are used:
>
> 1. When multiple Match or Region items start in the same position, the item
>    defined last has priority.
> 2. A Keyword has priority over Match and Region items.
> 3. An item that starts in an earlier position has priority over items that
>    start in later positions.

-- 
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui