Vim Recall繁體中文

Reindent inside braces

=i{

Example

Normal 0 / 2
{
 one
   two
}
keep
Cursor on line 2, column 3

Recalculate indentation inside a brace block.

Before & after
Before
{
 one
   two
}
keep
Cursor on line 2, column 3
After
{
  one
    two
}
keep
Cursor on line 2, column 3

Start in Normal mode. C indentation is enabled with expandtab and shiftwidth=2.

Details & Vim help

Example replayed in Vim

Recalculate indentation inside a brace block.

i{ excludes the outer pair. Vim applies its configured indent behavior to the selected lines; this is not a general code formatter unless equalprg provides one.