Tell me more ×
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

3 Answers

up vote 6 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

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

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

set smartindent

It will increase the indent in a new block.

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.