Indenting a bunch of lines in Vim
I use the following mappings to indent/unindent:
vmap <TAB> >gv
vmap <S-TAB> <gv
Use TAB to indent and shift-TAB to unindent the visually selected lines.
If a block is selected Vim indents/unindents what is right of the start of the block.
You can select a set of lines with visual line mode (via Shift + V), and then type
>
and, to dedent,
<
You can also add numeric arguments. Find out you didn't indent enough? Hit gv to re-select your previous selection.
While typing in normal mode, try out Ctrl + T or Ctrl + D to indent or dedent.
Use visual mode as Peter suggests. You can also use X>> where X
is the number of lines you want to indent. E.g. 5>> indents five lines from current line and down.