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?

link|improve this question

feedback

1 Answer

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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