Indent wierdness.

Nikolai Weibull mailing-lists.vim-ruby-development at
Thu Oct 20 18:04:10 EDT 2005

Hugh Sasse wrote:

>    def metaclass; class << self; self; end; end

Problem with counting of def and class versus ends.  We only see things
at the beginning of the line.

So don't write it in the shrivelled-up-I’m-in-a-book kind of way;
instead, write it as:

  def metaclass
    class << self; self; end

That won’t fool the indenter.  Perhaps we can rewrite the regular
expressions to do this kind of stuff, but I don’t remember if there were
issues with doing so.

If you want, please try redefining s:end_start_regex so that it can find
the ‘class’ in the above example as well.  That’d solve a lot of issues.
Perhaps my reasoning has been far too restrictive when it comes to that
variable.  You can try something like

let s:end_start_regex = '\%(^\|[^.:]\)\@<=\<\%(module\|class\|def\|if' .
        \ '\|for\|while\|until\|case\|unless\|begin\|do\)\>'

and report back on how that works.  It solves the issues you were having
now, but please verify that it doesn’t introduce something nasty....


Nikolai Weibull: now available free of charge at!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.

More information about the vim-ruby-devel mailing list