I recently switched over to Vim and after the initial hurdle I really like it. The only thing that might be a deal killer for me is the auto indents for erb tags being all messed up. I’m using the Janus plugin package which includes ruby.vim and rails.vim. I also added the html5.vim because someone told me it could help with that.
Here’s and example of the messed up indents it does:
<% unless @zipcode.latitude.blank? %>
<p>
<b>Latitude:</b>
<%= @zipcode.latitude %>
</p>
<% end %>
<p>
<b>Longitude:</b>
<%= @zipcode.longitude %>
</p>
Any suggestions at all would be much appreciated. It seems like there has to be a way to make a powerful editor like vim indent right. I’d hate to go back to sublime or aptana but this is a feature I really don’t want to live without.
I believe that there are 2 possible ways of solving your problem.
Firstly, temporarily remove the Janus distribution and replace it with a minimum .vimrc. Then install the ERuby plugin and see if it works. If it works now then the problem has to be a conflict with one of the other plugins, and you should try reenabling the different Janus plugins one by one to see where the fault lies. However, if it still doesn’t work then you know that the plugin itself doesn’t work on your system and you could send a detailed bug report to the author (including the operating system you are using and your vim version).
Alternatively, it is very easy to reconfigure Vim to use a different indentation method.
You could use a different built-in indentation (
:h indentexpr), for example for XML:Or you could configure Vim to use an external indentation program (
:h equalprg).