Avoid doing :set nopaste in VIM by using :r!cat: :r!cat def method # ... end Ctrl+D to end. Hat tip to @aaronfeng vimOctober 2nd, 2012