On Monday 01 May 2006 15:24, Yakov Lerner wrote:
> On 5/1/06, Michael Naumann <[EMAIL PROTECTED]> wrote:
> > Is there a way to highlight a sequence of non-tabs followed by a sequence
> > of tabs (/^[^\t]\+\t\+/) differently from the next such sequence?
>  >
> > For example in the line
> > a\tb\t\tc\td
> >
> > I want
> >  "a\t"   to be color1,
> >  "b\t\t" to be color2 and
> >  "c\t"   to be color3 (or probably color1 again)
> 
> Yes this is possible using custom syntax highlighting.
> The commands below do what dou ask for.
> 
> syn clear
> syn match Field1 /^[^\t]\+\t\+/ nextgroup=Field2
> syn match Field2 /[^\t]\+\t*/  nextgroup=Field3 contained
> syn match Field3 /[^\t]\+\t*/  nextgroup=Field2 contained
> hi  link  Field1 Constant
> hi  link  Field2 Operator
> hi  link  Field3 Type
> 
> However it removes all other syntax highlighting.
> If you want it to work together with other syntax, you have to
> figure it for yourself.
> 
> Yakov
> 
> 

Brilliant, exactly what I was looking for.
The nextgroup and the contained are the wise stuff here.

Thanx a lot

Michael

Reply via email to