tags:

views:

117

answers:

3

Hello there,

Is there a way to go the end of a Ruby block using vim? For example

module SomeModule

   # <Supposing that the cursor is HERE>
  def some_method
  end

end

I want to go from where the cursor is, to the end of the block with one command, is that possible?

I've read this documentation, but it doesn't seem to work on .rb files, I've read in some places that it only works on C (haven't tried though).

Thanks in advance.

+1  A: 
%

It works with most languages where it's clear that your cursor is on or near a block marker.

greyfade
This doesn't seem to work for Ruby.
Mark A. Nicolosi
That would work if and only if the cursor is either on "module SomeModule" or the "end" of that block. Not when the cursor is inside it.
Roman Gonzalez
It works perfectly fine on my installation of Vim7.2. On both def and module.
greyfade
Of course, the other block navigation commands should also work. If they're not working, check your Ruby ftplugin.
greyfade
I forgot to mention that I'm working on a macvim environment... probably the ftplugin is outdated, I'll check this out.
Roman Gonzalez
A: 

Try this - http://www.vim.org/scripts/script.php?script%5Fid=303 (Disclaimer: untested)

Swaroop C H
+1  A: 

Looks like there is an official package at rubyforge that has some support for this:

The Ruby ftplugin now includes Ruby specific implementations for the [[, ]], [], ][, [m, ]m, [M, and ]M normal mode commands. These allow you to move to move quickly between module, class and method declarations.

Edit: The README says that these files are included in the default VIM distro but they don't work for me in GVIM on Windows, '{' and '}' seem to work on vim under Linux

beggs