Better mechanism to choose the default editor (and avoid vi if possible)?

Marcus Harnisch mh-mercurial at online.de
Mon Jun 8 14:50:33 UTC 2020


On 08/06/2020 15.43, PIERRE AUGIER wrote:
> I know at least one distribution targeting "non-power users"
> (Ubuntu) which does not set $VISUAL or $EDITOR by default and does
> not patch Mercurial.

This is especially sad as they (perhaps Debian as well?) even
configure ‘/usr/bin/editor’.

> Do you know a distribution that does something like that?

What I was saying is that the distributor is in charge of packaging a
system-wide hgrc with ui.editor configured to something they ship or
even recommend for CLI usage in comparable scenarios. That way users
won't get confused why tool1 uses this CLI editor and tool2 another.

> It really depends on what you think is more important:
> 
> - using as the default editor the standard text editor of SUS/POSIX,
> - or taking care of users that are destabilized by vi.

- avoid error message saying “command not found”.

> I'm not sure that POSIX standard stands that applications should
> prioritize vi. I don't know but I understand it more like "vi must
> be there" than like "Your default editor has to be vi and the first
> thing beginners have to do is to learn enough vi to edit a file".

I am not suggesting to prioritize vi. It is just the least likely to
trigger an error on arbitrary Unixoid systems. The world isn't just
Linux.

> Finally, I didn't get what are the drawbacks of this setup (first
> environment variables + config files, then nano is available,
> finally vi as a fallback). Who is going to be disturbed by this?
> How? If few experimented users land in nano, won't they be able to
> set their preferred editor?

That of course would work just as well. Have *two* fallbacks 'nano'
and 'vi' (in that order). If that is acceptable, we'd have most people
covered.

Cheers,
Marcus





More information about the Mercurial mailing list