HP3000-L Archives

May 2002, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"John R. Wolff" <[log in to unmask]>
Reply To:
John R. Wolff
Date:
Thu, 2 May 2002 12:10:25 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (61 lines)
When I reluctantly bought our first HP9000 system several years ago I
decided to force myself to investigate and learn the UNIX commands that it
has so I could better understand its capabilities and limitations.  I
purchased several UNIX books and found many of them to be worthless or
difficult to use (like UNIX :-)).  However, some of the better ones turned
out to be the smaller handbooks that I still use today and would not be
without.

As part of the learning process I developed a large library of aliases and
scripts that together make the system tolerable and somewhat more user
friendly, using my MPE experience as a model of what was missing.  Anyway,
as you point out "vi" is one of the first rude shocks an MPE fugitive is
required to endure.  This usually takes place in an eary HP-UX class from
HP.  After wondering why, after all these many years, vi is still such a
user unfriendly tool I decided to investigate it further with my trusty
handbooks.

It turns out that vi is actually customizable and its behavior can be tamed
and improved with some careful configuration efforts.  There is a file
called .exrc which resides in a users home directory which controls vi
behavior and actually defines many of the commands.  They don't mention
this file when teaching vi to newbie UNIX users.  You can actually define
new commands (since the entire alphabet, both upper and lower case, is not
already defined) to do complex steps made up of other simpler commands.
Additionally, you can make it recognize all cursor control keys and behave
as you might expect it should.  The .exrc file is a little tedious to edit
because of the way it expresses escape characters, but can be mastered.  As
I said it resides in the home directory for each user so each user could
have a separate customization, if desired.  What we do is create a
master .exrc file and then provide a link for each user so everyone uses
the same one and maintenance is simplified.  I have even ported the .exrc
file to POSiX on the HP3000 with success.  The customizations take the
sting out of vi usage.

One of the features I created included a special insert for inserting just
1 character.  I found myself wanting to do this a lot and forgetting to
press escape afterwards.  Another is the "K" command to "KEEP" the file and
exit.  Control "K" does a ":wq!" to force save any kind of file.  If I use
a cursor key while editing, the escape is invoked automatically before
moving the cursor.  Etc., etc..

Another thing that made vi more useful was defining an alias
called "editor" which remembers the last 2 files edited.  If I quit vi and
want to go back and re-edit a file I am working on I just use the
command "editor".  If I want to switch back and forth between the current
file and the previous one I just use the command: editor -

Although vi is not designed in any way as my idea of an editor of choice,
it is an acquired taste.  Some of the features are nice, but just clumsy to
use.  My cheat sheet of vi commands is never far away if I need to do more
than the basic stuff.  The real problem is resetting your brain when going
back and forth between MPE and HP-UX.

If you are interested I can provide you with a copy of the .exrc file
and/or the alias.

Happy editing.

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2