Brad King wrote: > I'd like to improve C-syntax folding for a common code format style. > > With `foldmethod=syntax` the code: > > if (...) { > ... > } > else if (...) { > ... > } > else { > ... > } > > folds like this: > > +--- 3 lines: if (...) {--------------------------- > +--- 3 lines: else if (...) {---------------------- > +--- 3 lines: else {------------------------------- > > However, the code: > > if (...) { > ... > } else if (...) { > ... > } else { > ... > } > > folds like this: > > +--- 7 lines: if (...) {--------------------------- > > We can make the latter case fold like this: > > +--- 2 lines: if (...) {--------------------------- > +--- 2 lines: } else if (...) {-------------------- > +--- 3 lines: } else {----------------------------- > > by choosing on each line the lowest fold level that is followed > by a higher fold level. > > Please see patch attached. FWIW I've been running with this patch > for months to test it.
Making this change in the C code means all folding is affected. Most likely this will have side effects. Either this needs to be donein the C syntax, or we need an folding option to enable this behavior. -- BRIDGEKEEPER: What is your favorite colour? LAUNCELOT: Blue. BRIDGEKEEPER: Right. Off you go. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" 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 --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.