Sunday, December 27, 2009

Vim Tip: using "paste" to avoid the staircase effect

SkyHi @ Sunday, December 27, 2009

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!



Reference: http://www.dissociatedpress.net/2009/12/22/vim-tip-using-paste-to-avoid-the-staircase-effect/