Just moving over to Vim at the moment. In TextMate I could format code by hitting Cmd-Alt-[. How do I achieve the same in Vim?
See the answer below for the command. I found I also needed the following in my .vimrc so that Vim knew how to autoindent Ruby.
if has("autocmd")   filetype indent on endif 
                Vimcasts has a useful screencast on this subject that you may be interested in
gg=G  gg => go to start of file =  => apply autoformatting G  => ... to the end of file 
                        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