lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lynx-dev] How to Set vi as editor


From: Bela Lubkin
Subject: Re: [Lynx-dev] How to Set vi as editor
Date: Thu, 9 Dec 2021 00:16:54 -0800

[ completely irrelevant rambling here, move along... ]

Rudy Vener wrote:

> In my .profile I have:
> export EDIT=/usr/bin/vi
> export EDITOR=/usr/bin/vi
> export FCEDIT=/usr/bin/vi
> export VISUAL=/usr/bin/vi
>
> Note that some of the above environmental variables are specific to
> ksh, my default shell, and others may be legacy variables that I keep
> around simply from inertia. Still, it all works for me.

None of that is ksh-specific.  As usual for this sort of thing, there's
a lot of sillybuggers in the history...

Sorry.  Amateur shell historian here :)

$EDITOR is ancient, known forever to *ix programs which might want to
invoke an editor.

$VISUAL is slightly newer, came in around the development of `vi` at
Berkeley.  Most things that pay attention to $EDITOR check $VISUAL
first; typically, invoke $VISUAL if it exists, else $EDITOR, else some
compiled-in default.  Programs that think you might want to use a
different editor specifically for them will put $MYEDITOR in front of
the list -- like $FCEDIT.

$FCEDIT was invented by / for `ksh` (*), however, it is now widely used
amongst shells with ksh-like command line editing.  Furthermore my
current ksh(1) man page (for ksh93 '93u+ 2012-08-01') says:

    FCEDIT   Obsolete name for the default editor name for the hist
             command.  FCEDIT is not used when HISTEDIT is set.

... so it's actually deprecated by its parent.  (*): I think.  It might
have been picked up from some other contemporary which is now forgotten.

And, I don't know of any program in *ix-land that pays attention to a
$EDIT; though you may certainly have run into one.

I have 11 traditional-ish *ix shells on this system (13 if you count
`rc` and `sash`.  They're all over the map on this:

`bsd-csh` and `tcsh` have their own history methods, no need for
$FCEDIT.  (tcsh does use $EDITOR and $VISUAL for one silly unrelated
thing.)

bash, ksh, mksh, lksh, yash, zsh all have similar history with 'fc', all
pay attention to $FCEDIT.  Original (AT&T) ksh says it's a deprecated
name.  lksh seems to have working history despite no mention in its man
page.  bash & zsh run $EDITOR for 'fc' if $FCEDIT isn't set.  They also
both have a peculiar interpretation of $VISUAL.  They ignore its value,
just noting that it exists; then bash runs /usr/bin/editor while zsh
runs /bin/vi.  ??!?

The dash man page talks about history, binary doesn't have it.

The posh man page says 'FCEDIT: The editor used by the fc command (see
below)' -- and that's the last mention in the doc.  The binary doesn't
have it.

And, ash -- on my system is a symlink to busybox.  The busybox ash build
has no history and pays attention to none of those variables; the
overall busybox binary has references to $EDITOR and $VISUAL, but I
don't know for what.

Cheers,

>Bela<



reply via email to

[Prev in Thread] Current Thread [Next in Thread]