Turning off auto indent when pasting text into vim

2013-07-23 at 21:11:23 | categories: tips, vim

Turning off auto indent when pasting text into vim

Extracted information from this page.

I'm using vim as my editor of choice. Whenever I tried to paste some code using mouse (middle button) I had to switch of autoindent and cindent to avoid weird indentation. Solution for that was found under the link above and can be summarized as:

I added to ~/.vimrc this: set pastetoggle=<F9>

Then when I want to paste something into vim, I enter the insert mode, press F9, paste something, press F9 again.

It works like a charm :-)