Garbled text while pasting in vim

If you paste text in vim and sometimes it distorts the text like some extra indentation gets added. This is a pain for those who work with python 😛
This problem occurs when there is auto indent or smart indent enabled. There might be other reasons.
To solve this simply type in command mode:

:set paste

this will put vim in paste mode. And try pasting the same text now. It works.
To disable the paste mode, type:

:set nopaste

You may also try :set noai and :set nosi for disabling autoindent and smartindent respectively. When you are done pasting, do :set ai and :set si


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close