vi filename
Edit file.
vim filename
Same as vi, but more features.
view filename
Starts vim in read-only mode.
3 Types of Modes
Command Mode, Insert Mode, Line Mode
k
Up one line
j
Down one line
h
left one character
l
right one character
w
right one word
b
left one word
go to the beginning of the line
$
go to the end of the line
i
insert at the cursor position
I (this is a upper case i)
insert at the beginning of the line
a
Append after the cursor position
A
Append at the end of the line
:w
writes(saves) the file
:w!
forces the file to be saved
:q
Quit
:q!
Quit without saving changes
:wq
write and quit
:x
same as :wq
:n
position the cursor at linen
:$
position the cursor on the last line