Moving Around With vim (keyboard short cuts)

Moving around with vim.

Open any file, for example
$ vim /etc/httpd/conf/httpd.conf

1. Go to the first line
gg or 1 shift g or :0 (zero) Enter

2. Go to the last line.
Shift g or :$ Enter

3. Go to line 8
8 shift g

4. To scroll down one screen
Ctrl f

5. To scroll up one screen
Ctrl b

6. First position on line

7. Last position on line

8. Go to matching parenthesis

9. Right, left, up, down respectively.
l, h, k, j
Or You can also use arrow keys

10. Where Am I?
Ctrl g
Note: previous command works in command mode

From : Nixcraft

How To Show Line Numbers In vi / vim Text Editor

vi / vim show line number command

To display line numbers along the left side of a window, type any one of the following:
:set number
:set nu

(Fig.01: Vi / Vim line numbers in action – click to enlarge image)
To turn off line number again enter the same command:
:set nu!
If you need number every time you start vi/vim, append following line to your ~/.vimrc file:
set number
Save and close the file.
Jump to particular line number from a shell prompt, enter:
$ vi +linenumber file.c
$ vi +300 initlib.c

From : nixcraft