Turning off auto indent when pasting text into vim

Posted by Rimian on Stack Overflow See other posts from Stack Overflow or by Rimian
Published on 2010-03-25T09:52:47Z Indexed on 2010/03/25 10:23 UTC
Read the original article Hit count: 518

Filed under:
|
|
|

Unfortunately, I am not an experienced vim user. But, I am making the effort to learn it.

When I paste code into my document from the clipboard, I get extra spaces at the start of each new line:

line
  line
    line

I know you can turn off auto indent but mine doesn't seem to work because I have some other settings conflicting or something (which look pretty obvious in my .vimrc but don't seem to matter when I take them out).

Can someone please show me the way to turn this off when I paste code but still have vim auto indent when I am writing code? Please see my .vimrc file:

set expandtab
set tabstop=2
set shiftwidth=2
set autoindent
set smartindent
set bg=dark
set nowrap

Many thanks

© Stack Overflow or respective owner

Related posts about vim

Related posts about indentation