Pasting into Vim

Sometimes, I find that I need to paste text into Vim from a myriad of different sources.

Sometimes, this creates a huge mess of code full of automated indents which would be way too difficult to remove manually.

Fortunately, you can set Vim to “paste” mode so that it won’t do those automatic indents.

:set paste

Then go back to insert mode and you’re golden.

When you want to switch back:

:set nopaste