~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*         Most frequently used commands of vi          * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Positioning within file/cursor movement:
0 ------ beginning of a line
$ ------ end of a line ( ---- beginning of sentence/back a sentence
)  ------ to next sentence
{  ------ beginning of paragraph/back a paragraph
}  ------ end of paragraph/to next paragraph
H  ------ top line on screen
L  ------ last line on screen
M  ------ middle line on screen
j   ------ next line, same column
k  ------ previous line, same column
G  ------ move to the last line or the end of the text
1G   ---- move to the first line or the top of the text
88G ---- move to the beginning of the 88th line
nG   ---- move to the beginning of the specified line
^f     ---- move down one screen
^b    ---- move up/back one screen
arrow --- move cursor in Command mode
w     ---- to next word/forward a word
b      ---- back to former word/back a word
e      ---- end of word

2. Edit operations: words, sentences, paragraphs
Esc  ---- switch modes between Command status and Input status
i       ---- Insert text at the cursor position
a      ---- append after cursor
A    ---- append at end of line
o      ---- open a new line under the current line
O     ---- Open a new line above the current line
x ------ delete a character at which the cursor positioned
dw   ---- delete a word
dd    ---- delete a whole line
5dd  ---- delete 5 lines once
20dd ---- delete 20 lines once
yy     ---- copy a line: yank a line
5yy   ---- copy 5 lines
5yl    ---- yank 5 characters
5y+blank key ---- copy 5 characters beginning at the cursor
P       ---- paste from clipboard
J       ---- make the line below connected with the current line: join line
R      ---- Replace characters from the cursor position
/commCR ---- search for string "comm" from head to end and repeat
n       ---- repeat last search command
u       ---- undo previous change
U      ---- restore current line

3. File manipulation :
:wCR ---- write changes without exit
:qCR ---- quit
:q!CR ---- quit, discard changes
ZZ ---- exit vi, saving changes
:w nameCR ---- write file as "name"
^G ---- show current file and line
:r fn ---- insert a file at the cursor position


Notes:  (1). CR: stands for carriage return
             (2). ^ Control or Ctrl
             (3). This text edited with vi by az2@st-andrews.ac.uk, 14 September 1999 ================================================================