When i'm in Insert mode at vim, and press Shift+Insert to
paste my code to my file, vim disassembles my indentation , Such as:
Question: How can i solve this problem?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Vim is acting as if you had typed all of your pasted code by hand, so Vim will add additional indentation and otherwise change whitespace as it normally would, such as with your
autoindent setting. To paste code in Vim:
:set pasteto enable paste mode.
:set nopasteto disable paste mode so your normal typing will work as expected again.
:help paste for more information, including which options are disabled/altered when paste mode is on.
It's possible to set up mappings for this sort of thing if you do it a lot. See
:help imap for more information on that.