Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

<a>
    <b>
    <c>
</a>

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:

<a>
    <b>
        <c>
        </a>

EDIT

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.