Bad indentation when pasting into VIM
Sometimes with vim pasting you can visually select the copied code and press
=
which will reformat the code to your settings.
You may just have vim set to convert spaces to tabs. Try setting:
tabstop=4 shiftwidth=4 expandtab
in your .vimrc. Also, before you paste, just do
:set paste
Then insert, paste, then
:set nopaste
Here is a good writeup on paste mode.