On 7/24/06, Marc Weber <[EMAIL PROTECTED]> wrote:
background:
I want to highlight columns in a table differently (database output)
So 1 and 2 will be substituted by either \t or |.

============= syntax file ======================================================
hi def link Color1 Macro
hi def link Color2 Error

"Show colors of Color1, Color2
syn keyword Color1 A
syn keyword Color2 B

syn match Color1 '^1\zs[^1]*\ze'
syn match Color2 '^1[^1]*1\zs[^1]*\ze'
syn match Color2 '^2[^2]*2\zs[^2]*\ze'

============= testfile =========================================================
A
B
1aa1bb
2cc2dd

You don't need \ze at the end of match. Besides that,
you're trying to do overlapping matches.  This requires either
contains=..., or nextgroup=. Here's solution
using nextgroup=. Somehow, use of \zs screws the coloring.

Without \zs, the following works:

hi def link Color1 Macro
hi def link Color2 Error
hi def link Color3 Error

syn match Color2 '^2[^2]*2\zs[^2]*'
syn match Color1 '^1[^1]*' nextgroup=Color3
syn match Color3 '1[^1]*' contained

1aa1bb
2cc2dd

If you add \zs to Color1 and Color3 you'll that
it stops working. I dont know why.

Yakov

Reply via email to