Friday, March 30, 2012

How to do region syntax and avoid the effect of keywords.

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 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

No comments: