I just wonder if it´s possible to auto indent Rails Code in Vim instead of this:
validates :email, :presence => true,
:format => { :with => email_regex },
:uniqueness => { :case_sensitive => false }
to this:
validates :email, :presence => true,
:format => { :with => email_regex },
:uniqueness => { :case_sensitive => false }
The best way to do this is not actually to use built-in alignment in Vim, but rather the Align Plugin by Dr. Chip, which is used to horizontally align arbitrary symbols in vertical columns.
1,3Align =>
will align on the =>
, for example. You can get extremely detailed with the ordering etc by using the AlignCtrl
function, but the extent of its functionality is likely left to its documentation. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With