I am a Python user who sometimes copy and paste into Vim. (I switched from Mac to Windows WSL) and this was one of the glitches that bothered me.
If you touch a script.py
and then vi script.py
, Vi will detect it is a Python script and tried to be helpful, autoindent, paste with extra indents, etc. This won't happen if you don't tell it is a Python script.
However, if that is already happening to you, the default autoindent could be a nightmare when you paste already fully indented code (see the tilted ladder shape below).
I tried three options and here are the results
set paste # works perfect set noai # still introduced extra whitespaceset noautoindent # still introduced extra whitespace