On Fri, 17.10.14 15:45, Mantas Mikulėnas (graw...@gmail.com) wrote: > On Fri, Oct 17, 2014 at 3:11 PM, Lennart Poettering > <lenn...@poettering.net> wrote: > > On Fri, 17.10.14 14:29, Mantas Mikulėnas (graw...@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
I'd argue that if people really are strange enough to try to use such a dumb terminal and expect to get ed or ex, then they should just set $VISUAL/$EDITOR to that and be done. Or in other words: if that distinction really makes sense they should set the right editor themselves in their .profile, based on the $TERM they find set (or not set). Either way, I think we should honour $EDITOR because it makes sense, and $VISUAL because it's probably more universally used and for historical compatibility. I think Ronny's patch was pretty close to what I think it should work like. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel