vim Indentation Indent or outdent lines


Example

To indent our outdent the current line in normal mode press the greater than > key or the less than < twice accordingly. To do the same on multiple lines just add a number beforehand 6>>

CommandDescription
>>indent current line
<<outdent current line
6>>indent next 6 lines

You can also indent using motions. Here are a few useful examples.

CommandDescription
>ggindent from current line to first line in file
>Gindent from current line to last line in file
>{indent previous paragraph
>}indent next paragraph

In visual mode by pressing the greater than or less than key just once. Note that this causes an exit from visual mode. Then you can use . to repeat the edit if you need to and u to undo.