Ruby/vim folding question

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

===============================================================================

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

set foldmethod=syntax
set foldnestmax=5 " usually 3, but more for this case

···

On 11/21/05, Ara.T.Howard <ara.t.howard@noaa.gov> wrote:

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

--
Jim Freeze

Ara.T.Howard wrote:

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

This is exactly the problem I tried to solve in
  http://eigenclass.org/hiki.rb?Usable+Ruby+folding+for+Vim

HTH

···

On Tue, Nov 22, 2005 at 10:33:23AM +0900, Ara.T.Howard wrote:

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

  modules
  classes
  methods

--
Mauricio Fernandez

eigenclass.org has been down for ~4H this morning but it's back up, in case
you still want to take a look.

···

On Tue, Nov 22, 2005 at 05:55:51PM +0900, Mauricio Fernández wrote:

On Tue, Nov 22, 2005 at 10:33:23AM +0900, Ara.T.Howard 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

--
Mauricio Fernandez

Mauricio Fernández wrote:

···

On Tue, Nov 22, 2005 at 05:55:51PM +0900, Mauricio Fernández wrote:
> On Tue, Nov 22, 2005 at 10:33:23AM +0900, Ara.T.Howard 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...

Gavin

Mauricio Fernández 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. 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...

Gavin

        Hugh

···

On Wed, 23 Nov 2005, Gavin Sinclair wrote:

> On Tue, Nov 22, 2005 at 05:55:51PM +0900, Mauricio Fernández wrote:
> > On Tue, Nov 22, 2005 at 10:33:23AM +0900, Ara.T.Howard 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 :slight_smile:

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 :slight_smile: 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).

···

On Wed, Nov 23, 2005 at 01:05:12AM +0900, Hugh Sasse wrote:

--
Mauricio Fernandez

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.

···

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.

--
http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org