vi commands - the most common vi navigational commands

There are a lot of commands for navigating through a file with the vi editor (or, more recently, the vim editor), but the reality is that I've used various forms of Unix (Ultrix, AIX, CLIX, SCO Unix, etc.), Linux, and more recently Mac OS X, and there are only a few vi commands that I use for moving around in a file.

So I thought I'd list those here, the most common vi commands.

Moving on the current line
0 Move to the beginning of the current line
$ Move to the end of the line
5[RightArrow] Move right five spaces
7[LeftArrow] Move left seven spaces
w Move forward to the next word
4w Move forward four words
b Move backward one word
8b Move backward eight words
Moving within the file
1G Move to the first line (beginning) of the file
G Move to the last line (end) of the file
[UpArrow] Move up one line
[DownArrow] Move down one line
5[UpArrow] Move up five lines
4[DownArrow] Move down four lines
H Move to the top line in the current screen
L Move to the bottom line in the current screen
M Move to the middle line in the current screen