Knowledge for the World

Reformat or fix the indentation of an entire file in vim

This short guide will help you reformat or fix the indentation of an entire file in Vim -- all at once!

1

I wrote a separate guide that will show you how to set indentation rules in Vim.

2

gg=G

"=" is the indent command and it can takes motions. So "gg" means start at the beginning of the file and "G" means finish at the end.