avoiding increasing indents while pasting into vi

Tags: Vi, unix
Updated: September 22, 2009
Contributors: Mike Franks

When pasting text into a vi editing screen, sometimes you’ll get each line increasingly indented like this.

aaaaaaaaaaaaaaaaaa
 bbbbbbbbbbbbbbbbbb
  cccccccccccccccccc

Use this command to change the “paste” setting. Then change it back when you’re done.

:set paste

:set nopaste