Bug?: Vim folding for Ruby broken

Hugh Sasse Staff Elec Eng hgs at dmu.ac.uk
Tue Nov 16 13:18:03 EST 2004

On Tue, 16 Nov 2004, Kaspar Schiess wrote:

> Hello Hugh,
>>> +   def foo
>>> |     [1,2,3].each do
>>> |+      puts
>>> ||    end
>>> |   end
>> Can you tell us what you expected to happen?
>> Maybe cat a file containing a modeline (like  # vim:set sw=2 et: )
>> and an example that fails then we can be (mor) sure what we are
>> testing?
> The trouble is with the fold starting at the line marked with '+', meaning 
> the line containing the 'puts' string, and not the line where the 'do' 
> keyword actually occurs.
> You seem to lack fold margin, this is a very nice feature IMHO, you can

No, I've got it, just never used it.
> enable it by
> set fdc=5
> (for a fold column of 5). This also shows you where folds start and where 
> they end.

OK, I see what your problem is now -- the fold would start at puts
instead of starting at the line with do, although it doesn't do this
in a class.  Although I added folding in the first place to ruby's
vim syntax file, I just added it where it looked right, and was
unawere of subtleties.  I'm fairly sure others have modified it
since, but I'm not sure how to track this down...
> I think we have to find out if your version of vim folds these lines as mine 
> does (question A) and if the folding behaviour (if the answer to A is yes) is 
> what you suppose it to be.

No, mine folds within the methods in the same way in and outside the
class [file attached for repeatability]  -- this 'cut and paste'ed
from a vim window:

      #!/usr/local/bin/ruby -w

-    class A
|-      def foo
||-         [1,2,3].each do
|||             puts
|||         end
||      end
|    end

-    def foo
|-      [1,2,3].each do
||          puts
||      end
|    end

This is with 
brains hgs 26 %> ls -ltr ruby.vim
-rw-r--r--   1 root     other      19448 Oct 27 16:43 ruby.vim
brains hgs 27 %> md5sum ruby.vim
MD5 (ruby.vim) = f573acdb6a8920022665a08ae2866418
brains hgs 28 %> pwd
brains hgs 29 %>

And I don't understand why yours is showing + instead of - for open folds.
> Attached to this mail is a screenshot of a part of my vim interface, showing 
> the rendering with fdc=5.

Thank you, that made the above possible...

> Thank you for investing in this,
> kaspar
> hand manufactured code - www.tua.ch/ruby

:-) as opposed to www.codegeneration.net ? :-)
> PS: This message might get misthreaded since I currently cannot access 
> vim-ruby trough gmane. I hope that will be fixed in the next few days...

         Hope the above is of some use...

-------------- next part --------------
#!/usr/local/bin/ruby -w

class A
   def foo
       [1,2,3].each do 

def foo
   [1,2,3].each do 

More information about the vim-ruby-devel mailing list