This post originated from an RSS feed registered with Ruby Buzz
by Eigen Class.
Original Post: Usable Ruby folding for Vim
Feed Title: Eigenclass
Feed URL: http://feeds.feedburner.com/eigenclass
Feed Description: Ruby stuff --- trying to stay away from triviality.
The folding methods you get with a default vim install (even with
updated Ruby support) are
unsatisfying for a number of reasons:
fold_syntax and fold_indent create far too many folds (e.g. for syntactical elements like if or while). On top of that, they're nested, so you have to open folds recursively all the time. foldnestmax isn't an option because you never know how many class/module levels you're going to get: a value that works fine for code wrapped in a module would show too many folds in one consisting of bare (private Object) method definitions.
fold_marker requires too much work to mark all methods and classes
fold_expr could work but it would involve a fair deal of vimscript
As happens often with vim, spotting what I dislike is easier than finding
right away what I want. I now know I want code folding in Ruby to work as
follows:
no need for manual markers in general, but I want to have the option to use them.
folds for modules, classes, methods and constant definitions, and nothing else. I specifically want no intra-method folding (on if and such): if the method is large enough to warrant folds, you're screwed anyway.
no nested folds: I don't want to have to open a class fold to look at the folded methods.