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!
Set the indentation rules in your .vimrc
I wrote a separate guide that will show you how to set indentation rules in Vim.
With the target file open in vim type
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.