Format Ruby code in Vim
问题 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 回答1: 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 回答2: When I see questions