When you pasting text from other sources into Vim using mouse right-click, the format may be messed up due to auto-indenting. Use the following command to enable pasting mode:
:set paste
After the pasting is done, revert to normal mode:
:set nopaste