Formatting an Entire Buffer

Starting with the cursor in the middle of an un-formatted buffer:

Initial Conditions
<div>
····<p>line·one</p>
······<p>line·two</p>
········<p>line·three</p>
····</div>
NORMAL
50%
3:1
 

The first step is to execute gg, which moves the cursor to the top of the buffer:

Move to Top of Buffer
gg
<div>
····<p>line·one</p>
······<p>line·two</p>
········<p>line·three</p>
····</div>
NORMAL
Top
1:1
 

Next, we execute =, which tells Vim to format the lines traversed by the associated motion. We follow this with G, which indicates that we want to apply formatting from the current line to the bottom of the file:

Format the Entire Buffer
=G
<div>
········<p>line·one</p>
········<p>line·two</p>
········<p>line·three</p>
</div>
NORMAL
Top
1:1
5 lines indented

The end result shows that the combination of gg and G includes all lines in the file.