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=G``.
gg moves cursor to beginning of file. =G formats the code from the cursor to the end of the file. `` brings the cursor back.
    
Top comments (1)
Also,
gqis similar to=. Example:gggqGThe behavior of
=andgqare customizable viaequalprgandformatprgoptions respectively.See,
:help =,:help equalprg,:help gq,:help formatprgfor more info.