VISUAL/EDITOR = emacs in ksh

Donald Lashomb donlash at uncle.UUCP
Wed Dec 13 13:42:19 AEST 1989


In article <464 at cpsolv.UUCP> rhg at cpsolv.uucp (Richard H. Gumpertz) writes:
>I am using ksh on a AT&T 7300 (operating system release 3.51, which is roughly
>equivalent to V 2) and have a few questions:
>1) What is the difference between using VISUAL=emacs and EDITOR=emacs?  Why
>   should I prefer one over the other?

If you set VISUAL to a pathname that ends in emacs, gmacs, or vi, then ksh
turns on the corresponding option no matter what EDITOR is set to - no default.
EDITOR, same thing but can be overridden by VISUAL and defaults to /bin/ed.
I usually set both of these and EDIT too, to all the same editor.  Some
programs you might use look at EDITOR, some look at EDIT.

>2) My .profile does VISUAL=emacs followed by export VISUAL.  Although this
>   defines $VISUAL, it does not appear to set emacs editing mode.  For that
>   I have to type VISUAL=emacs manually to the shell.  Why does ksh look at
>   just the variable and not the environment?  What can I do to get around
>   this?

Check out your ksh ENV file (.kshrc probably), .profile runs first, then ksh
does ENV.  AT&T-supplied .kshrc does "set -o vi -o viraw", this is overriding
your VISUAL setup in .profile.  Change it to "set -o emacs".

>3) I would like to run the equivalent of a .profile in every sub-ksh that I
>   start.  How do I go about doing that?  That is, execute a script file and
>   then enter interactive mode upon invocation of ksh.

The ENV file is executed everytime ksh is invoked.

TFB (The F***ing Book) =
	The Kornshell Command and Programming Language
	Morris I. Bolsky and David G. Korn
	Prentice Hall

hope this helps - Donald Lashomb



More information about the Unix-pc.general mailing list