On Wed, July 13, 2011 7:13 pm, Ben Fritz wrote: > On Jul 13, 1:11 am, "Christian Brabandt" <[email protected]> wrote: >> On Tue, July 12, 2011 11:33 pm, Ben Fritz wrote: >> > Are you asking for every other line to be highlighted in a different >> > color as shown in the screen shot? >> >> > You can't do it exactly like the screenshot, and it will slow down >> > performance greatly, but you might be able to use a bunch of >> > matchadd() calls, to set up matches for all text on each line. >> >> I tried once using several >> :syn match Evenl /.*/ nextgroup=Oddl >> :syn match Oddl /.*/ nextgroup=Evenl >> :hi Evenl ctermbg=Red ctermfg=Black >> :hi Oddl ctermbg=Yellow ctermfg=Black >> >> Unfortunately, this did not work. I am not sure why. My understanding >> of the syntax highlighting was, that the nextgroup parameter should >> force matching the next group. But somehow it ends always matching the >> same group. Not sure if this is a bug or my understanding is wrong. >> > > I think it is because you aren't including the newline in the match. > So, Oddl matches first, tries matching Evenl on the line ending (which > fails because line endings aren't matched with '.'), and therefore > Oddl matches again on the next line. Possibly just using ^.*\n as the > pattern would fix it, but this will probably not work well together > with existing syntax highlights. That's why I suggested matchadd()
Yes, this works. Thanks for pointing me to the obvious ;) regards, Christian -- 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
