Vim tends to do nice indenting but wants to leave comments without one by default. This makes code look bad. This is a short reminder on how to make it right.
Set following to your ~/.vimrc :
filetype indent on set autoindent
And that's it :)
If you've got a file that needs re-indenting open it with vim and issue following command :
:gg=G
And you've just indented the file.
If you find bugs above please comment below. Also feel free to rate.