Commonly used vi commands
Commonly used vi commands:
a=append text after current character (insert text mode)
i=insert text (insert text mode)
b=goto previouse word
cw=change word
[n]dd=delete line to delete multiple lines type: type a number before dd
dw=delete word      
d$=delete up to end of line
=finish inserting text (go back to command mode)
g=global search
G=goto end of file
j=go down 1
J=join lines
o=insert a new line after
O=insert a new line before
[n]r=replace character
R=replace characters until 
s=replace character and insert text
u=undo previous change
w=goto next word
x=delete character
[n]yy=copy line, P to paste (for cut and paste: dd then P), to copy multiple lines type:type a number before yy
ZZ=write and exit
~=toggle case of a character
/=find a string
n=repeat find
^=goto the first nonspace character
0=goto the beginning of the line
$=goto the end of the line
^b pg up
^m pg dn

: commands         
:e[filename]=edit file      
:q! quit without saving
:r[filename]=read file in
:s/oldstring/newstring/g   replaces oldstring with newstring  /g (global) will do the operation on the whole line for every line
:1,$/oldstring/newstring/g 1 means start @ line 1 and replace strings until the last line (end of the document ($) )
:set number will display line numbers on the left side of each line
:wq or :x=write and exit
:w!=force write
:[linenumber] goto a specific line number