Turn off auto indentation when pasting in vim

Sometimes when trying to paste code into using Ctrl + V it annoys us to see auto indentation in vim messing it up, to turn off autoindent when you paste code, there’s a special “paste” mode. Type

:set paste

Then paste your code. Note that the text in the tooltip now says -- INSERT (paste) --.

After you pasted your code, turn off the paste-mode, so that auto-indenting when you type works correctly again.

:set nopaste