OK I keep forgetting all these tricks, but make sure to turn autoindent on
and then you get nice indenting. So with the >
and <
to indent forward, there is CTRL-T
to indent and CTRL-D
to outdent. Then you get these tricks.
Where you combine those operators with %
which says go to the first bracket or brace. Then there is the =
operator which says reindent that you can combine as well
>> Indent line by shiftwidth spaces
<< De-indent line by shiftwidth spaces
5>> Indent 5 lines
5== Re-indent 5 lines
>% Increase indent of a braced or bracketed block (place cursor on brace first)
=% Reindent a braced or bracketed block (cursor on brace)
<% Decrease indent of a braced or bracketed block (cursor on brace)
]p Paste text, aligning indentation with surroundings
=i{ Re-indent the 'inner block', i.e. the contents of the block
=a{ Re-indent 'a block', i.e. block and containing braces
=2a{ Re-indent '2 blocks', i.e. this block and containing block
>i{ Increase inner block indent
<i{ Decrease inner block indent