When I wind up with code that is not well formatted, the
= command comes in
handy. This command runs applies a formatter to your motion or visual
selection. So two handy sequences of commands I keep at hand are
=%. The later takes advantage of the
matchit plugin which
% to match a broad array of open close blocks like those found in the
Ruby programming language.
gg=G formats the entire file:
Note that reformatting can be performed on a visual selection by hitting
after selecting with
Lastly, the command that performs formatting can be set using
:help = and
:help equalprg for more details.