Copy and Paste reformats text adding spaces: VIM
Sometimes if you copy and paste indented code into VIM, you’ll end up having lines starting at the far right. It gets worse while more lines of code are pasted, and even more the higher the level of indent in the original code.
Solution: Turn off autoindent in VIM. In other words, get into PASTE mode.
:set paste
Once pasted get out of PASTE mode.
:set nopaste