Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The first XML Builder Example for Nokogiri looks like this:

builder = Nokogiri::XML::Builder.new do |xml|
    xml.root {
      xml.products {
        xml.widget {
          xml.id_ "10"
          xml.name "Awesome widget"
        }
      }
    }
 end
 puts builder.to_xml

Even though I have the Ruby Vim files installed, Vim's autoindent flattens the above example like this:

builder = Nokogiri::XML::Builder.new do |xml|
  xml.root {
    xml.products {
    xml.widget {
    xml.id_ "10"
    xml.name "Awesome widget"
  }
  }
  }
end
puts builder.to_xml

Does anybody know how to get Vim to autoindent this correctly?

share|improve this question

1 Answer 1

I can reproduce this.

The indentation rules are defined in the function GetRubyIndent, which is in /usr/share/vim/vimcurrent/indent/ruby.vim on Linux and Unix systems.

The problem seems to be that GetMSL returns 8 for line 3, but also returns 8 rather than 12 for line 4.

If you have a bit of time, have a look at the source code and try to find and fix the problem.

If not, you might like to report it as a bug at the RubyForge Vim/Ruby project site.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.