Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use the middle-click, or CTRL-SHIFT-V to paste indented selection into Vim:


I have tried to

:set nosmartindent
:set nosmarttab

It's used to working, but recently nosmartindent doesn't work any more. The result is something like:



It seems like I should also disable the filetype:

set filetype=text

Then, things go right, no more indents again.

But, should I have to set nosmart*, set filetype=text each time before paste?

share|improve this question
up vote 5 down vote accepted

I assume you are not talking about gvim, but the console vim.

Your vim seems unaware that you are pasting and treats the pasted text as inserted as if typed. Try putting vim in paste mode:

:set paste

Once you are done pasting leave paste mode again:

:set nopaste

See this entry in the vim wiki for more information.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .