Last Updated: February 25, 2016
·
540
· anthonysutardja

Fixing indentations in vim

To fix indentations in your code:

gg=G

  • gg moves the cursor to the beginning of the document
  • = is the indent command
  • G is the modifying motion that = can take.

Cheers.

2 Responses
Add your response

Great stuff. I often use = in visual mode to indent only specific methods/blocks in my code. For example to indent the next 5 lines v5j=.

over 1 year ago ·

@janahrens This is the same:
=5j</code>

over 1 year ago ·