
From uoguelph.ca!hpulley  Thu May 12 20:06:40 1994 remote from mwc
Received: by lepanto.chi.il.us (smail2.5.3-coh) id AA08709; 12 May 94 20:06:40 GMT (Thu)
Received: by mwc.com (smail2.5.3-coh) id AA19975; 12 May 94 19:14:31 GMT (Thu)
Received: from herman.cs.uoguelph.ca by relay2.UU.NET with SMTP 
	(5.61/UUNET-internet-primary) id AAwppi12582; Thu, 12 May 94 14:30:43 -0400
Message-Id: <9405121830.AAwppi12582@relay2.UU.NET>
Received: by herman.cs.uoguelph.ca
	(1.37.109.8/16.2) id AA00678; Thu, 12 May 1994 14:32:08 -0400
Date: Thu, 12 May 1994 14:32:08 -0400
From: Harry C Pulley <hpulley@uoguelph.ca>
To: fred@mwc.com
Subject: Re: vi tutorial
Newsgroups: comp.os.coherent
X-Newsreader: TIN [version 1.2 PL2]
Status: RO

In article <9405120929.AA7972.V1.5@lepanto.chi.il.us> you wrote:
: The time has come to write a vi tutorial.  I will be starting this in the
: next few weeks.  As I am an emacs bigot, I will be learning vi as I go
: along, so this should be an interesting task.

If you learn enough to write the tutorial you may just convert yourself! ;-)

: If you have any vi techniques you wish to pass on, or if there are points
: you believe such a tutorial should cover, please mail them to me at the
: address below.  Thanks!

You should definitely cover tags.  It is great to be able to do ":ta
init_curses" and jump to that function.  Or, if you have tagged an entire
directory, it is great to be able to type "vi -t init_curses" and vi will then
load whichever source file contains that tag and start you at the start of that
function.

Other things to mention are the " cut buffer commands.  They allow you to name
buffers and cut and paste from them while editing many files.  It is useful if
you have sections of code which have boiler plate regions and other regions.
You can save the first region in cut buffer a, the second in b and so on.  Then
when you are using them you paste buffer a, write the non-boiler plate section,
paste buffer b, etc.

Next, some often forgotten commands are (, ), {, }, and [[ and ]].  ( and ) go
to next and previous sentence or function call, etc.  { and } go to next and
previous paragraph.  [[ and ]] go to next and previous function.  These are all
very useful when traversing both text files and program code.

The w, W, b, B, e, E commands are also very useful.  w and b go to the next or
previous word, not including punctuation.  W and B go to the next work
(delimited only by whitespace).  e goes to the end of the next (or current if
not already at the end) word, not including punctuation; E does the same,
except that only whitespace delimits words.

The % command is great for matching brackets.  It is nice when you have missing
curly braces in a C program and you can't see where you forgot one.

The ^, $ and 0 commands are useful for line positioning.  ^ goes to head of
line (first non-whitespace), $ to end, and 0 to first character including
whitespace.

The mark command (m) is very useful.  With it you can mark various locations in
your document or program and return to them later.  ' mark goes to the line
containing the mark.  ` mark goes to the exact character position of the mark.

The " paste command can also be used to undelete lines.  If you use " with a
number instead of a letter then it represents the nth last delete.

The f, F, ;, , commands are very useful too.  f finds a character in the line
forward, F finds backward.  ; finds the next letter of the last f command, and
, finds the previous one.  This is useful when you are cutting and pasting.
You can paste a line and they type f1.  This will take you to the first 1 in
the line.  You can then do r2 to change it to a 2.  Then hit ; and you will be
at the next 1 which you can also change to a 2.

The . command is great for doing the last command.  Using the . and , or ;
commands is quite powerful.

The cw command changes the current word.  Using the find commands and this
command with the . command is a very simple way to go through a file and change
selective occurances of a string.

Both / and ? are necessary for finding text.  A discussion of general regex
expressions and ex editing is useful, but not necessary for a vi beginner.

As well, the dw and dW commands are useful for deleting works. D is used to
delete to end of line.

Finally, the CTRL-^ command is great for switching back and forth between two
files being edited.  After you start up vi you load the second one with the :e
command.  Then you can switch back and forth between them.

The :n and :N commands are useful when editing many files from the command
line.  :n goes to the next file and :N goes to the previous file.

Well, that should hold you for now!  I use all of these commands daily.  Using
them, I can type up reports, essays and program code in no time!

Also, you should make sure that you ship the correct version of virec (the
recovery command) with the next version of Coherent.  4.2 currently has 1.7 of
vi but only 1.5 of virec.  The old version of virec cannot read files from 1.7 
elvis.

Harry
--
        hpulley@uoguelph.ca       |This message released|It takes all kinds,
        Harry C. Pulley, IV       |to the PUBLIC DOMAIN.|and to each his own.
----------------------------------+---------------------|This thought in mind,
Stay away from the DOS side, Luke!|Un*x don't play that.|I walk alone.

From tfnet.ils.unc.edu!lou  Fri May 13 17:17:15 1994 remote from mwc
Received: by lepanto.chi.il.us (smail2.5.3-coh) id AA11145; 13 May 94 17:17:15 GMT (Fri)
Received: by mwc.com (smail2.5.3-coh) id AA28636; 13 May 94 16:29:42 GMT (Fri)
Received: from tfnet.ils.unc.edu by relay2.UU.NET with SMTP 
	(5.61/UUNET-internet-primary) id AAwpsq12635; Fri, 13 May 94 12:01:00 -0400
Message-Id: <9405131601.AAwpsq12635@relay2.UU.NET>
Received: by tfnet.ils.unc.edu
	(16.6/16.2) id AA27291; Fri, 13 May 94 12:02:09 -0400
Date: Fri, 13 May 94 12:02:09 -0400
From: Lou Sortman <lou@tfnet.ils.unc.edu>
To: fred@mwc.com
Subject: Re: vi tutorial
Newsgroups: comp.os.coherent
In-Reply-To: <9405120929.AA7972.V1.5@lepanto.chi.il.us>
Organization: TRIANGLE FREENET
Cc: 
Status: RO

Well, the only gem that I can think of right now is that to swap two lines,
move the cursor to the first of the two and type "ddp".
That deletes the line that you're on and puts it after the next one;
resulting in the lines being swapped.
It's one of those automatic mnemonics that you just type to get a desired
effect.

