Quantcast
Channel: Turning off auto indent when pasting text into vim - Stack Overflow
Viewing all articles
Browse latest Browse all 28

Answer by B.Mr.W. for Turning off auto indent when pasting text into vim

$
0
0

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

enter image description hereenter image description here


Viewing all articles
Browse latest Browse all 28

Latest Images

Trending Articles



Latest Images