Hi,
I would like to fold C code at { and } but with functions only, not
for 'if', 'for', 'switch' etc.
And I would like to keep #if, #endif folds, too.
(1)
My current workaround is not satisfying because I spoil the code with
markers: I fold based on markers '#if', '#endif' and add them in C
comments for funtions like this:
FUNC(...){/*#if*/
...
}/*#endif*/
(2)
I would love to go for syntax folding but the default folds on 'if',
'for' etc as well. I do not like using the default syntax folding +
simply set foldminlines=SOMELINES because it never really fits (you
can have many short functions, and I do not want to fold long or short
if() clauses at all).
(3)
I tried setting up my own c.vim syntax, but it seems quite complex to
define what is a pattern for a function? Because function names are
hard to define, but 'if', 'for', 'switch' are known, I though of
going the other way round excluding patterns like "if + ( ... ) {"
from my function fold group somehow. I failed.
(4)
Finally I thought, an easier approach was to allow #if, #endif as
usual, and { } folds just for the top level (not nested), as functions
never appear nested inside of {}. But how to do that?
Thank You for any hint!
Felix
--
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