COMMAND
COMMENT
EXAMPLES
------------------------------------------------------------------------------
vi filename
editor
vi file1
i
insert before cursor
a
add after cursor
R
replace
o
open new line below cursor
O
open new line above cursor
esc ******************** exit insert mode ***************************
arrow keys
cursor movement
-
move cursor up one line
+
move cursor down one line
x
delete this character
dw
delete this word
[n]dd
delete line(s)
3dd
p
paste delete-buffer
control-f
page forward
control-b
page backward
control-u
1/2 page up
control-d
1/2 page down
:set number
display with line numbers
:set nonumber
return to no line numbers
:n
move cursor to line n
:149
:$
move cursor to end of file
/
search forward for string
/begin
n gives next occurence
?
search backward for string
?for
n gives next occurence
:w
write to file
:w myfile
:q!
quit vi without writing
:1,$ s/st1/st2/g
replaces all occurences of st1 by st2
ZZ
write and quit
--------------------------------------------------------------------------------