[net.unix] editing history list in ksh

tut@ucbopal.UUCP (06/08/84)

Does the Korn shell spawn a new vi or emacs process every time you want
to edit some command in the history list?  This strikes me as inefficient,
particularly on architectures where forking is slow.  Or does ksh have
a subset of vi built in?  This strikes me as an inefficient use of memory,
and a long-term maintenance problem.

I've always thought ^K (vertical tab) would be a good way to bring down
a character at a time of the previous command.  Tandem's OS has a feature
like this.  Most people think the ^^^ and !!:gs substitutions of csh are
awkward-- who really knows what type of regular expressions are used there?
Calling vi or emacs seems like overkill-- in most cases a good typist can
rekey the line before vi (let alone emacs) starts up.  But with the method
proposed here, you could hold down ^K (using erase if necessary) until you
want to insert something, type it, then press ^K again until you're done.
The code to implement ^K would certainly be smaller than the code to handle
csh history substitutions.  No changes to the tty driver are required.

Bill Tuthill

alan@allegra.UUCP (Alan S. Driscoll) (06/10/84)

> Does the Korn shell spawn a new vi or emacs process every time you want
> to edit some command in the history list?  This strikes me as inefficient,
> particularly on architectures where forking is slow.  Or does ksh have
> a subset of vi built in?

No forking is done.  Instead, a subset of 'emacs' is built into the ksh.
(There is also a subset of 'vi' for the masochist.)  The command line is
treated as a one line window into the history list. In emacs mode, typing
^P replaces the current command line with the previous command, typing ^R
allows a reverse search through the history list, and so on.
-- 

	Alan S. Driscoll
	AT&T Bell Laboratories