Sunday, March 2, 2008

vim - stop autoindent while pasting text

On a putty terminal, when you copy-paste code from other sources, it results in a complete mess, due to vim trying to format it again. To avoid this, type

:set pastetoggle=

Now you can use to toggle between paste mode (and no paste mode).

When in paste-mode auto indent will be turned off. This is very useful when pasting text that's already indented.

source:
http://amix.dk/blog/viewEntry/19083

3 comments:

Anonymous said...

I was looking for this command , thanks!

sandeep said...

@Anonymous
Happy Vimming :) !

Anonymous said...

Thanks for the tip !
Note that you can add :set comments= in order to disable comments indenting