For years I’ve been trying to figure out how to keep Vim from automatically indenting when I copy from one file to another.
Stackoverflow mentioned this page buy a developer named Marcin Kulik
let &t_SI .= "\
let &t_EI .= "\
This code automatically turns off the Vim indent functionality when new text is pasted into a file. Just add it to your .vimrc file.
It’s the same as a set paste and set nopaste before and after pasting new text, but it happens automatically. I’ve tested it and it seems to be working PERFECT. I love it!