Short List of vi commands
To start vi :
vi filename
where filename is the name of the file you wish to edit.
A few vi commands
- h, moves cursor left
- j, moves cursor down
- k, moves cursor up
- l, moves cursor right
- x, delete character
- dw, delete word
- dd, delete line
- p, put last deletion after cursor
- u, undo last change
- i, turn on insert mode (hit the esc key twice to stop)
- :wq, write file and quit
- :q!, quit without saving file
- ctrl f, move forward one page
- ctrl b, move backward one page
- /text, will search for next occurance of 'text' (hitting n will find next occurence)
- G, go to end of file
- 1G, go to first line of file