Indent/format an entire file using vim
You can format/indent an entire file using the vim editor and the gg=G command.
gg - Goto the beginning of the file = - apply indentation G - till end of file
If you decide not to indent your file, just press u to undo the last operation.