Sometimes I need to paste something to my code in VIM. Needless to say if you don’t know how to use the paste functionality properly in vim, it pretty much screws the indentation of the copied text. That’s when :set paste comes in. When you want to paste to your file, just enable set and paste, the indentation will remain intact.
If you are like me and do not want to type :set paste everytime you want to paste,you can include “set pastetoggle=<f1>” in your .vimrc file. Basically what it does is, it enables you to toggle between the paste mode and the normal insert mode by pressing f1. Pretty Handy.