ruby/vim folding question

A

Ara.T.Howard

any ruby/vim gurus out there know how to fold only these:

modules
classes
methods

based on syntax method folding?

fold level won't cut it here since i might have

module A
module B
module C
module D
class C
def method
end
end
end
end
end
end

??

-a
--
===============================================================================
| ara [dot] t [dot] howard [at] gmail [dot] com
| all happiness comes from the desire for others to be happy. all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================
 
J

Jim Freeze

any ruby/vim gurus out there know how to fold only these:

modules
classes
methods

based on syntax method folding?

fold level won't cut it here since i might have

Not sure I understand the problem.
Folding works for me. I have

set foldmethod=3Dsyntax
set foldnestmax=3D5 " usually 3, but more for this case
 
G

Gavin Sinclair

Ara.T.Howard said:
any ruby/vim gurus out there know how to fold only these:

modules
classes
methods

based on syntax method folding?

No, I don't know.
fold level won't cut it here since i might have

module A
module B
module C
module D
class C
def method
end
end
end
end
end
end

Good question, though!

Gavin
 
G

Gavin Sinclair

Mauricio said:
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...

Gavin
 
H

Hugh Sasse

---559023410-1254324197-1132675487=:21819
Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-1254324197-1132675487=:21819"

This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

---559023410-1254324197-1132675487=:21819
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN
Content-Transfer-Encoding: QUOTED-PRINTABLE

=20

=20
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. 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.

I don't actually understand how to use your script there...
=20
Gavin
=20
Hugh
---559023410-1254324197-1132675487=:21819--
---559023410-1254324197-1132675487=:21819--
 
M

Mauricio Fernández

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).
 
T

tony summerfelt

Hugh Sasse wrote on 11/22/2005 11:05 AM:
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.

cream for vim allows you to fold any block of lines. cream makes
things easy for the vim newbie, but the full power of vim is just a
keystroke away.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top