VI HELP
vi file ( to edit a file name )
vi .*.def ( to edit all .def files)
COMMANDS
Save/Quit
:q to quit file
:q! quit without saving
:w to write file
ZZ exit and save
Moving Around
G go to end of file
1G go to beginning of file
$ go to end of line
0 go to beginning of line
j down one line
k up one line
h left a character
l right a character
Ctrl-D Scroll Down
Ctrl-U Scroll Up
( the arrow keys usually work for moving around )
Searching
/ to search for something (forward)
? search from where you are backwards
n next search
N prev search
Insert
i enter insert mode before current character
a enter insert mode after current character
I insert at beginning of line
A append to end of line
o open an insert line below
O open an insert line above
Esc to end insert
yy copy a line
10yy copy 10 lines
p paste a copied line
P paste a copied line above the current position (UPPER CASE P)
u undo
cw change word ( from where you are to space or punctuation )
c5w change 5 words
c$ change from where you are to end of line
Deleting
x delete character
3x delect 3 characters
dw delete word
d$ delete to end of line
dG delete to end file
dd delete line
10dd delete 10 lines
Search and Replace
:1,$s/F0F0F0/G0G0G0/gi search from line 1 to end of file ( 1,$s )
replace F0F0F0 with G0G0G0 globally (g), ignore case (i)
Selective search and replace
/F0F0F0 (enter) search
cw G0G0G0 Esc make change
n next search
. repeat change