Change depth of indentation in vi

Mark it, then use > and <.


In vim (not sure if this applies to you too), you use >> to indent one line. As with nearly every command in vim, type in a number before the command to perform is multiple times. So to indent the next 50 lines, type 50>>.


Autoidenting:

For a { } block I use the command: =iB (with the cursor inside the block to ident)

For re-identing a complete file, I use gg=G

Now for increase or decrease identation on a block, you have to select it (I use viB command) and then you do >> or << and if you want to repeat the identation just use the dot .

Also remember to set your identation settings with

:set shiftwidth=NUMOFSPACES

and

:set softtabstop=NUMOFSPACES

Tags:

Vi

Editing