On Mon, 24 Jul 2006 13:06:47 -0500, Gautam Iyer <[EMAIL PROTECTED]> wrote:
>> I use foldmethod=expr with the following foldexpr: >> >> set foldexpr=GetFoldLevel(v:lnum) >> >> function! GetFoldLevel(line) >> let line_text = getline(a:line) >> if (line_text =~ '\%({.*}\)\|\%(}.*{\)') >> return '=' >> elseif (line_text =~ '{') >> return "a1" >> elseif (line_text =~ '}') >> return "s1" >> endif >> return '=' >> endfunction >I haven't read the above too carefully: But if all you want to do is >fold your code based on {...} blocks, then use Vim 7 and set fdm=syntax >(for C / C++ files). Unfortunately, that doesn't work for the way I do my folding. I also insert braces manually in comments where I want folds, e.g.: //@{ Private data. private int blah; //@} >Incidentally, fdm=syntax is also slow (though much much faster than >fdm=expr). I could (grudgingly) live with a short delay when first >loading the file. The thing that bothers me is that when I switch >between buffers, Vim takes it's own sweet time to get the syntax based >folding right. I wonder why, because you'd think it would be about the same work as just figuring out the syntax highlighting? >So I only enable syntax folding for files that have less than 3000 >lines. Once my clever spies steal Benji Fisher's computer, I'm going to >up this limit to 18000. I have a quad qore Opteron machine, perhaps if vim could take advantage of all the CPUs it would be tolerable. :) -- Be seeing you.