Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using vim on Ubuntu 10.10.

In order to indent code, I enter >. But I have to do it twice.

Other command, like < and = are the same. I have to do it twice.

Is it normal? Of I should change something?

How can I fix this?

share|improve this question
up vote 3 down vote accepted

That is the normal operation. The first > starts the indent command. The second > commits the indent command. What you put in between defines what you want to indent (defaults to 1 line):

  • >> is indent one line.
  • >5> is indent 5 lines
  • >G is indent to the end of the file.

The >G doesn't need a trailing > to commit the command as the G command is a terminating command already.

share|improve this answer

If you want to abbreviate this, you can create a macro that indents just the current line or some other preset value. For example:map <tab> >1>

share|improve this answer

I use>} to indent a paragraph (a chunk of code up to the next empty line)

share|improve this answer

If you want to indent a line say 3 levels, you can use the "." motion to repeat the last action after indenting.

Eg:

>>..
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .