To paste preformatted text into Vim without having the code autoindented, you have to activate the paste mode before actually pasting the text into Vim:
:set paste
After you have finished pasting the text, you may deactivate the paste mode to have pasted text autoindented again, using the following command:
:set nopaste