vi (visual editor, pronounced "vee eye")

usage:
vi, or vi <filename>

options:
vi -r = list vi swap file information
vi -b = binary mode, allows editing of binary files
vi +# <filename> = open file and start at line #
vi +/<search phrase> <filename> = search document for specified phrase, start on that line

modes
i = insert mode, before current cursor location
a = insert mode, after current cursor location
I = insert mode, at beginning of current line
A = insert mode, at end of current line
o = insert mode, creates blank line below current location
O = insert mode, creates blank line above current location
cc = insert mode, clear current line
c <movement command> =  insert mode, clear word, sentence, paragraph, character to left or right, and so on (starting from cursor location)
v = visual mode, used for selecting text
ESC = command mode

commands
:w <optional filename> = write file
:wq = write file and quit
:q = quit if no changes were made (since last save)
:q! = quit and do not save changes
:e! = revert to last saved version
:e <filename> = open file
:# = go to line number specified by #
:sp <filename>  = open file a new split window buffer
Ctrl-W, Ctrl-W = toggle between split windows
Ctrl-W, Ctrl-J = move down one split window
Ctrl-W, Ctrl-K = move up one split window
ZZ = quit and save

shell commands can be entered like so :!<command> such as :!who

movement:
h = move cursor left (left arrow)
j = move cursor down (down arrow)
k = move cursor up (up arrow)
l =  move cursor right (right arrow)
0 = move to first character of line (home)
^ = move to first non-blank character of line
$ = move to last character of line (end)
w =  move cursor to first character of next word
b = move cursor to first character of previous word
e = move cursor to last character of next word
W = move cursor to first character of next bigword
B = move cursor to first character of previous bigword
E = move cursor to last character of next bigword
( = move cursor to first character of previous sentence
) = move cursor to first character of next sentence
{ = move cursor to start of previous paragraph
} = move cursor to start of next paragraph
f<character> = move to next usage of character on line
#, Enter = move foward # lines
#G = move cursor to  # line, 3G moves the cursor to the beginning of the 3rd line
#gg = move cursor to  # line, 3gg moves the cursor to the beginning of the 3rd line
gg = move to beginning of document
G = move to bottom of current screen
H = move to top of current screen
Ctrl-F = move forward one page (page down)
Ctrl-B = move backward one page (page up)

bigword sidenote:
"hi-how-are-you" is treated as several normal words in vi, use the bigword commands to have it treated as a single bigword.

combo sidenote:
movement commands can also have a # value placed in front of them,  5w would move the cursor over 5 words.
this method can also be used with c and d  commands. d5w would delete the next 5 words, c5w would do the same and then go to insert mode.

editing:
x = delete character  where the cursor is located (delete)
#x = delete # characters from cursor, 2x would delete 2 characters
dd = delete current line
#dd = deletes # lines (current line included)
D = delete the rest of line from current cursor position
dw = delete current word
cw = change current word
#cw = change # words from current position
r <new character> = replace current character with new character
R = replace text until Esc is pressed
J = join  the line below current line to the end of current line
. = repeat last editing command
d<movement command> = delete word, sentence, paragraph, character to left or right, and so on (starting from cursor location)
u = undo last command. can be used repeatedly
U = undo every change on current line
y = copy/yank selected text
yy = copies current line
d = cut selected text
p = paste text before cursor position
P = paste text after cursor position

searching and replacing:
/string = highlights all instances of string specified. repeating this command will move the cursor to the next instance of the string.
?string = highlights all instances of string specified. repeating this command will move the cursor to the previous instance of the string.
n = repeats the search forwards to next instance
N = repeats the search backwards to previous instance

literals sidenote:
. $ \ ^ literals will all require a \ to be placed in front of them to be included in the search.

:s/string_to_replace/replacement_string/ = replaces first instance of string with replacement on current line
:s/string_to_replace/replacement_string/g = replaces all instances of string with replacement on current line
:%s/string_to_replace/replacement_string/ = replaces all instances of string with replacement for the entire document
:%s/string_to_replace/replacement_string/c = replaces all instances of string with replacement for the entire document, but with interactive confirmations for each instance