Quick Reference to the vi editor

================ vi.n === (first page of quick intro) =========
	Quick Introduction to the vi Visual Editor


ENTERING vi

	vi filename		Start vi editor with the file called name
			        The file is created if it doesn't exist.

EDITING MODES

In the vi editor there are two modes:

command mode: This is the default when vi starts up.
insert mode: You need to be in this mode to type text. 

Changing modes: Type the letter i to enter insert mode from command mode.
                Hit the Escape key to enter command mode from insert mode.


LEAVING vi

	ZZ		exit from vi, saving changes.
	:q!		exit from vi, discarding changes.
	:wq     exit and save changes.

CURSOR POSITIONING

	h		moves left one character position.
	j		moves down one line.
	k		moves up one line.
	l		moves right one character position.

		 NOTE: Normally you will be using the four keys that correspond 
               to left, down, up, and right arrows on the keyboard.

	0	(zero)	moves to the beginning of a line.
	w		moves right one word.
	b		moves left one word.
	CTRL-u	moves up 1/2 screen full.
	CTRL-d	moves down 1/2 screen full.
	G		moves to the bottom of the file.
	nG		moves to line number n.
	:n      moves to line number n
	:set number  show line numbers for all lines in the file.
	CTRL-l	clear screen and re-draw.

TEXT MODIFICATION

	itextESC	inserts   text   to the left of the cursor.
			 Insert doesn't cause the cursor to move;  text
			 appears as it is typed, terminate with the ESC key.
	atextESC	appends  (inserts)   text   to the right of the
			 cursor, terminate with ESC.
	RtextESC	Replaces (overprints) characters at the cursor
			 position, terminate with ESC.
	dd		deletes the line the cursor is on.
	ndd		deletes   n   lines from the cursor position.
	D		deletes characters from the cursor position to the
			 end of the line.
	x		deletes the character at the cursor.
	nx		deletes   n   characters to the right of the
			 cursor.
	u		undo the last change.

PATTERN SEARCHING

	/pat/	positions the cursor at the next occurrence
			of the string pat.

NOTES:
	CTRL-	represents the CTRL key.  Hold the CTRL key and press the
		following key simultaneously.

=================== (second page of vi quick intro) ==========

	Second Level vi Editing Commands

CURSOR POSITIONING

	}		move down one paragraph.
	{		move up one paragraph.
	mx		save the current cursor position and label it
			with the letter x. (x is any letter)
	'x		return to the cursor position labeled x.

TEXT MODIFICATION

	dw		delete the next word.
	.      (period) repeat last change.
	A		append at the end of the current line.
	P		put back deleted line(s).  Text deleted with D
			and dd commands may be pasted back with the P
			command.  Text is pasted in before the cursor
			position.
	:a,bs/old/new/	From line number 'a' to line number 'b', substitute
			the pattern 'old' with the pattern 'new'.  You
			may use any text string which doesn't contain a
			carriage return in place of the 'old' and 'new' 
			strings.  Use CTRL-G to tell what line the cursor is
			on.
PATTERN SEARCHING

	//		search for the next occurrence of a previously
			specified search string.  

MISCELLANEOUS

	:w		write out current changes.  The vi editor works
			on a copy of your file.  The :w command causes
			the editor to write its copy over the original
			which is on the disk.
	:w name		write out changes to the file  name  .  This is
			like the :w command but the changes are written
			into the file you specify.  (good for making
			intermediate copies)

Cut and Paste	Move to the start of the text to cut.  Use dd
			to delete (cut) several lines.  Use D to cut only
			the end of one line.  Move to the place where you
			wish to paste the text.  Use P to put back the text.
			You may need to clean up the spacing after pasting.