vi  notes
The IBM AIX "vi" program is a text editor – a tool used to create and edit files. If these files are made "executable" the file is then referred to as a "script". These scripts can be as simple as a single command or as complex as thousands of lines that can even launch other scripts (sub-programs).
To create or edit a file, type "vi  filename" (not the quotes) where filename is the name of the file you want to create or edit. If the file does not exist, a new one will be created. If the file does exist, the contents of the file will appear on the screen for you to edit.
vi has three modes:
1. Command mode allows you to move about your program without changing the text itself – you just enter commands. You are in the command mode when you first start vi. To access the command mode at any time press the <Esc> key.
2. Insert mode allows you to enter or edit text. See commands below to start insert mode.
3. Last line mode is used to save the program, load another program, or quit. Press the <Esc> key to access command mode (unless you are already in it) and then press the colon (:) followed by the last line command that you want to use (see below).
Common vi commands
Note: If your terminal type ($TERM) is set properly, you will be able to use the arrow keys to maneuver around within the file.
Insert Delete
Insert characters Insert line Delete characters Delete line
I
beginning of line
O
above current line
X
before character
dd
current line
A
end of line
o
below current line
x
at cursor    
i
before cursor    
D
at cursor to end of line    
a
after cursor            

Miscellaneous Last line mode
/string search from cursor to end of text for ‘string j next line :n go to line number ‘n
/ find next occurrence of ‘string H top of screen :q! quit (without saving changes)
h space left M middle of screen :w write changes (without exiting)
l space right L bottom of screen :wq write changes and quit
k previous line G end of file    
Last update: Saturday October 09, 1999 08:00 EDT by Vernon Frazee CounterCounter