Re: Contextual highlighting problem
On 8/28/06, A.J.Mechelynck [EMAIL PROTECTED] wrote: Yongwei Wu wrote: [...] However, it is only a *little* better. Scroll down to make the first comment line disappear on the top of the Vim window, and press Ctrl-L, highlighting will have problems. C comments have not this problem. More clues? Best regards, Yongwei See the various flavours of the :syntax sync command: :help :syn-sync :help :syn-sync-maxlines :help :syn-sync-linebreaks :help :syn-sync-firstfromstart :help :syn-sync-second ccomment :help :syn-sync-thirdminlines :help :syn-sync-fourth patterns: grouphere, groupthere, linecount Thanks! I believe syn sync minlines should work in most of the cases. However, I do find that there is some magic in C. Just save my syntax file as c.vim in vimfiles\syntax, and the test.asm file (renamed as test.c) works perfectly. Check attachment if interested. Anyone knows where the magic is? -- Wu Yongwei URL: http://wyw.dcweb.cn/ c.vim Description: Binary data .386P .MODEL FLAT, C COMMENT * This is some comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment More comment COMMENT * trailing text .CODE mov ax, 1 .DATA warnDB'Can''t find file.' ; Can't find file. END
Re: Contextual highlighting problem
On 8/28/06, Yongwei Wu [EMAIL PROTECTED] wrote: I am trying to implement the COMMENT directive in the MASM syntax file: Treats all text between or on the same line as the delimiters as a comment. COMMENT delimiter [[text]] [[text]] [[text]] delimiter [[text]] The current way I deal with it is: syn match masmComment COMMENT\s*\(\W\)\_.\{-}\1.* However, when the first line (containing `COMMENT') is not visible, refreshing the page will immediately render the highlighting wrong: the lines are no longer regarded as comments. I tried using region, but 1) I do not know how to let `end' find exactly the same delimiter as `start'; :help /\z( :help /\z1 Yakov
Re: Contextual highlighting problem
On 8/28/06, Andy Wokula [EMAIL PROTECTED] wrote: Yongwei Wu schrieb: I am trying to implement the COMMENT directive in the MASM syntax file: Treats all text between or on the same line as the delimiters as a comment. COMMENT delimiter [[text]] [[text]] [[text]] delimiter [[text]] The current way I deal with it is: syn match masmCommentCOMMENT\s*\(\W\)\_.\{-}\1.* However, when the first line (containing `COMMENT') is not visible, refreshing the page will immediately render the highlighting wrong: the lines are no longer regarded as comments. I tried using region, but 1) I do not know how to let `end' find exactly the same delimiter as `start'; 2) refreshing the display still make the highlighting fail. I find that the multi-line C comments do not exhibit this problem. But I am not able to figure out the magic. Any help? Best regards, Yongwei :help :syn-ext-match HTH Andy Thanks, Andy and Yakov. Yes, this works for region. I now use: syn region masmComment start=+COMMENT\s*\z(\W\)+ end=+\z1.*+ However, it is only a *little* better. Scroll down to make the first comment line disappear on the top of the Vim window, and press Ctrl-L, highlighting will have problems. C comments have not this problem. More clues? Best regards, Yongwei -- Wu Yongwei URL: http://wyw.dcweb.cn/
Re: Contextual highlighting problem
Yongwei Wu wrote: [...] However, it is only a *little* better. Scroll down to make the first comment line disappear on the top of the Vim window, and press Ctrl-L, highlighting will have problems. C comments have not this problem. More clues? Best regards, Yongwei See the various flavours of the :syntax sync command: :help :syn-sync :help :syn-sync-maxlines :help :syn-sync-linebreaks :help :syn-sync-firstfromstart :help :syn-sync-second ccomment :help :syn-sync-thirdminlines :help :syn-sync-fourth patterns: grouphere, groupthere, linecount Best regards, Tony.