To move the cursor, you must be in command mode. On most of the modern terminals, you can move the cursor with the arrow keys on your keyboard.
Symbol | Function |
---|---|
l | Move one character right |
h | Move one character left |
j | Move one line down |
k | Move one line up |
< space > | Move one character right |
G | Go to last line of the file |
nG | Go to line number n in the file |
$ | Go to end of current line |
^ | Go to start of line |
w | Go to beginning of next word |
b | Go to beginning of previous word |
e | Move to end of word |
H | Go to first line of screen |
M | Go to middle line of screen |
L | Go to last line of screen |
( | Go to beginning of sentence |
) | Go to end of sentence |
{ | Go to beginning of paragraph |
} | Go to end of paragraph |
Before using any of these commands, make sure that you are in the command mode by pressing the ESC & : key.
You can also instruct the vi editor to display the line number with each line using the :set number command.