I wish I had seen this five years ago!
I'm always doing
:set paste
and :set nopaste
whenever I need to paste text from other sources into vim. Or, rather, I would paste, see the crazy indents and comment characters auto-repeating, and have to decide if I should revert, issue the :set paste, and try again; or if it would be quicker to manually clean up what I just did.I just added the code to my .vimrc. Works like a charm.