From: "Mauricio Fernández" Date: 2005-11-23T03:07:15+09:00 Subject: Re: ruby/vim folding question On Wed, Nov 23, 2005 at 01:05:12AM +0900, Hugh Sasse wrote: > > > > > any ruby/vim gurus out there know how to fold only these: > > > > > > > > > > modules > > > > > classes > > > > > methods > > > > > > > > This is exactly the problem I tried to solve in > > > > http://eigenclass.org/hiki.rb?Usable+Ruby+folding+for+Vim > > > > > > eigenclass.org has been down for ~4H this morning but it's back up, in case > > > you still want to take a look. > > > > Gee, that looks awesome! Might be enough to get me to use folding... > > I took a look at that. Quote: "On top of that, they're nested, so > you have to open folds recursively all the time.". Well, there is > zO (zed, capital Oh) and zC. Of course, nobody would want to open them manually :) >when I first added folding to ruby's syntax file, (a) it was rather a hack, >and (b) I considered that people might want to fold all sorts of things, >particularly long if while, etc, blocks that weren't relevant, seeing the >wood for the trees. That makes sense; it just isn't what I want to use folds for (intra-method inspection). I would like to keep methods small enough to be easily inspected without requiring internal folds. You can actually define them with specific markers (#{{{), but that wouldn't work so well with "flat" (unnested) folds. > I don't actually understand how to use your script there... It folds on class, module, constant and method definitions (you can change that easily). It's probably more hackish than the syntax file, but I like it the way it is :) It should work standalone, just by adding the script to .vimrc. Then the :R command will set foldmethod=manual and create the folds, which will be shown if foldenable is set (so zi might be required). -- Mauricio Fernandez