[systemd-devel] [PATCH] systemctl: add edit verb

Dale R. Worley worley at alum.mit.edu
Mon Oct 13 06:38:34 PDT 2014


> From: David Herrmann <dh.herrmann at gmail.com>
> 
> On Sat, Oct 11, 2014 at 8:17 PM, Daniel Buch <boogiewasthere at gmail.com> wrote:
> > Nice, I was in the process of implementing this. Looks good to me. But I
> > think it would be better to use "vi" instead of "vim" if no &editor is set.
> > Vim is not installed on every system as default but vi is most likely.
> 
> I'd prefer doing nothing. "vi" has quite different behavior than
> "vim", especially in Ex mode. And for people uncomfortable with 'vi'
> it's even worth. And everyone should have set EDITOR anyway..

My general understanding is that the traditional behavior when "you
need an editor but the user hasn't specified one" is to use "vi", and
so people who don't want "vi" *always* set $VISUAL in their
environment.

If you're being really nice, the program determines whether the
terminal is dumb or visual, and then goes through the sequence of
choices:

1) $VISUAL if the terminal is visual and it is specified
2) $EDITOR if it is specified (or if $VISUAL fails to execute)
3) vi if the terminal is visual
4) ed or ex (I think)

(I don't know what the test for visual is.  It may simply have been
trying to execute $VISUAL (and vi) and seeing if they exit with an
error.)

Dale


More information about the systemd-devel mailing list