Reindent the whole file
gg=G
Example
Normal 0 / 1Normal 1 / 1{
one
two
}
keepCursor on line 2, column 3{
one
two
}
keepCursor on line 1, column 1Apply indentation rules from the first line to the last.
Apply indentation rules from the first line to the last
Before & after
{
one
two
}
keepCursor on line 2, column 3{
one
two
}
keepCursor on line 1, column 1Start in Normal mode. C indentation is enabled with expandtab and shiftwidth=2.
Details & Vim help
Example replayed in Vim
Apply indentation rules from the first line to the last.
gg moves to the first line, = begins the indentation operator, and G extends it to the last line. Results depend on filetype, indent settings, or equalprg.