On Fri, Mar 30, 2012 at 11:09 PM, Ben Fritz <[email protected]> wrote: > On Friday, March 30, 2012 3:33:13 AM UTC-5, Yichao Zhou wrote: >> Hi, everyone. >> >> I want to let vim use syntax to fold c's function in K&R like. >> >> int main() >> { >> return 0; >> } >> >> So I write this: >> >> syntax region function start='^\h\+\_.\{-}\n\_^\ze{' end="}" >> contains=ALLBUT,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell >> fold keepend >> >> But I find that the "int" on the beginning of the file will stop this >> syntax rule become effective. If I change "int main" to "aint main", >> everything is OK. How to deal with this problem? > > You might be able to work around it, by using a zero-width look-behind like > \@<=. Possibly \zs will work as well. > > I'm not sure if either will work, however. If two matches begin at the same > place, keyword always takes precedence and there's no way around it beyond > removing the keyword or making it contained. I'd expect \@<= to be more > likely to work than \zs but may make the highlight much slower. > > -- > 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
Em... This is too ugly and I don't success. Maybe I should hack into vim's sources code and add a priority option for syntax? -- 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
