To fix file indentation, you can simply go to beginning of the file (gg) and execute =G.
I find it especially useful when working in Android with XML files that don't have parameters sorted. Formatting the file in Android Studio, using CMD+ALT+L would fix indentation, but also order of parameters in tags, making the diff more difficult to read.