[systemd-devel] [PATCH] systemctl: add edit verb
Mantas Mikulėnas
grawity at gmail.com
Fri Oct 17 05:45:01 PDT 2014
On Fri, Oct 17, 2014 at 3:11 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Fri, 17.10.14 14:29, Mantas Mikulėnas (grawity at gmail.com) wrote:
>
>> > Technically proficient people will set $EDITOR or $VISUAL
>> > anyway. Non-technical people won't. Non-technical people are likel to
>> > be totally lost in vi/vim. For those folks probably nano makes a
>> > better choice, simply because it shows an explanation of they
>> > supported keys at the bottom of the screen.
>> >
>> > Hence, I think doing a logic like this would make sense:
>> >
>> > 1) if $EDITOR is set, use it
>> > 2) otherwise: if $VISUAL is set, use it
>> > 3) otherwise: if "nano" exists, use it
>> > 4) otherwise: if "vim" exists, use it
>> > 5) otherwise: if "vi" exists, use it
>>
>> The list of editors seems fine.
>>
>> Normally $VISUAL would be first, followed by $EDITOR...
>>
>> (But in practice nobody sets them to different values anyway, since no
>> programs aside from mailx care about the distinction. So it's fine
>> either way, and just ignoring $VISUAL would be just as good.)
>
> Is there a real distinction between $VISUAL and $EDITOR? environ(7)
> makes no distinction, have any better docs that clarify the supposed
> distinction?
It's much older than me, but as far as I know, one would have had
$EDITOR set to 'ed' or 'ex' for "dumb" typewriter-based terminals
(which were used before CRT terminals were a thing) and $VISUAL to
'vi' or 'emacs' for CRT-based terminals (which could show full-screen
programs), and programs would start the right one depending on $TERM
value.
But these days, I haven't seen any program (other than mailx) actually
care about the differences; they pretty much always go $VISUAL ||
$EDITOR || something || something || vi. So most people have both set
to the same editor, just in case. So I'd safely get rid of $VISUAL
--
Mantas Mikulėnas <grawity at gmail.com>
More information about the systemd-devel
mailing list