Ruby coding in Vim

I copied the Ruby example in Vim, but it turned out that it messed up the indent. I tried to get Vim to apply a specific Ruby indent. To do this, I uncommented the following lines in the global vimrc file:

if has ("autocmd") filetype plugin indent on endif 

And pressed gg=G in Vim. Now it changes part of the indentation, but it still has some errors:

  • Class definitions are indented.
  • Comments are not indented and remain at the beginning of lines.
+7
source share
1 answer

Before pasting from an external source, use this command

:set paste

then enter insert mode and paste.

+1
source

All Articles