I found myself writing code without paying attention to formatting: let it be written as it is written, Vim will format it later. And the easiest and fastest way to do this is to format the whole file:
gg moves cursor to beginning of file.
=G formats the code from the cursor to the end of the file.
`` brings the cursor back.