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.

Then I press [Enter] in insert mode, there is a new line. But cursor places in the very beginning of a line. What do I do to create new line with the same indentation as the current's?

share|improve this question
1  
I recommend that you spend a little time Googling for 'vim configuration' or the like. There's a ton that you can set in your ~/.vimrc file. –  Telemachus Jan 23 '10 at 21:24
    
and that's how google takes me to here. –  towry Apr 28 at 13:02

3 Answers 3

up vote 8 down vote accepted

add set autoindent to your ~/.vimrc can do that for you automagically.

share|improve this answer
    
thanks! there was no .vimrc, is it ok to create a new one? –  valya Jan 23 '10 at 21:13
    
yes, under your home directory. –  John T Jan 23 '10 at 21:15

I'd also suggest adding this to your .vimrc:

set smartindent

It will increase the indent in a new block.

share|improve this answer

Both will annoy you when pasting (as vim will try and indent everything on the fly). So prior to pasting:

:set paste

share|improve this answer
    
This is true in the terminal. If you're using gvim you shouldn't need this. –  Nathan Fellman Jul 28 at 17:25

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.