Vim Tip: Using “paste” to Avoid the Staircase Effect

1323
Article Source Dissociated Press
December 22, 2009, 1:37 pm

If you’re working in Vim and paste something into the terminal, sometimes you’ll get a “staircase” effect where each line is progressively spaced farther outward, like so:

line 1  line 2   line 3    line 4 

Obviously, this isn’t usually desirable.

To correct this, you can enable paste to prevent the staircase effect. In command mode, type:

:set paste

This isn’t on by default. When paste is enabled, it disables mapping and some other functions, so you probably want to know how to turn it off as well:

:set nopaste

Happy vimming!