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.

So the tabbing is correct on the website itself, but when I paste it into the terminal, each line becomes tabbed further out than the previous one, and is horrendous to fix manually. How do you make it so that the alignment remains the same as it was when it was on the website (correct)?

share|improve this question
    
Why did you feel the need to add "(legally)"? –  romainl Dec 30 '11 at 7:05
    
Is it not appropriate to do so? –  Dark Templar Dec 30 '11 at 7:26
    
1. It's totally irrelevent to your question. 2. The il/legality of copying code from the web is not at all a settled question. –  romainl Dec 30 '11 at 8:15
    
It's open source, and I was instructed by the developer to copy it :) –  Dark Templar Dec 30 '11 at 21:13
    
That's good, kudos to him and the FOSS "movement". –  romainl Dec 30 '11 at 21:59
add comment

2 Answers 2

up vote 4 down vote accepted

Try using :set paste just before you paste something into vi. Once you've pasted in all you want, :set nopaste.

You might want to consider set noautoindent in your vimrc file. The vim wikia page on auto indenting might intrigue you.

share|improve this answer
    
Thank you!! :-) –  Dark Templar Jan 3 '12 at 18:00
add comment

Vim is capable of pasting indented code from the clipboard without using the mouse. Example: Mark your text in firefox, open vim, then use " * ] p. See :help ]p:

["x]]p or *]p* *]<MiddleMouse>* ["x]]<MiddleMouse> Like "p", but adjust the indent to the current line. Using the mouse only works when 'mouse' contains 'n' or 'a'. {not in Vi}

share|improve this answer
add comment

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.