From: utzoo!decvax!harpo!eagle!mhtsa!allegra!psuvax!sibley
Newsgroups: net.unix-wizards
Title: RE: redo
Article-I.D.: psuvax.1066
Posted: Fri Jul 30 14:54:35 1982
Received: Sat Jul 31 06:11:21 1982


I also use a 'redo' command instead of relying on the
history mechanism mess.  Mine just takes an entry from
the history list, puts it in a file, runs ex open
mode on it, and executes the result.  I spent a lot of
time fooling with this to get rid of quoting problems and
ambiguity.  The whole thing is done with the following
alias:
    alias redo 'echo \!*:q > ~/cmd; ex +open ~/cmd; source ~/cmd'

It is used as
    redo !-3
for instance, to edit the third previous command.  The
following alias is used to get the immediately previous
one:
    alias again 'redo \!-1 '

The only real difficulty is that the command line as
stored on the history list aleady has had history
substitution performed on it, so it may not be exactly
what you typed.  There seems no way around this.  The one
line messages on entrance to and exit from the editor are
a minor annoyance, but I don't know a reasonable way to
suppress them.  Otherwise it works great.

One obvious advantage of my system is that the editor is
a familiar one -- just vi with a one line window.  It's
also probably more powerful than any special purpose
editor cooked up just for this and requires no separate
maintenance.

Try it and let me know how you like it.

Dave Sibley
Department of Mathematics
Penn State University
psuvax!sibley