nanosudo? (default update-alternatives --config editor choice)

Phil Dobbin bukowskiscat at
Mon Dec 24 07:48:38 UTC 2012

On 12/24/2012 07:30 AM, Paul Sladen wrote:

> On Sun, 23 Dec 2012, Phil Dobbin wrote:
>> On 12/23/2012 09:55 PM, Paul Sladen wrote:
>>> On Sun, 23 Dec 2012, Phil Dobbin wrote:
>>>> 12.04 ... when I ran the visudo command, it plonked me into nano.
>>> Which editor would you prefer Ubuntu to default to?
>> Well, the clue is in the name: visudo. vi
> I think there's a selection of Unix commands (crontab -e, visudo, ...)  
> which cause a text-editor to be loaded with a pre-selected file.
> In which case, perhaps some options are:
>   a. Hard code 'visudo' to be non-standard (not use $EDITOR)
>   b. Change the system-wide $EDITOR default to be 'vim'
>   c. Something else (please specify)
>>> Can you list the advantages and distadvantages (pros/cons)
> In order to have a discussion about changing the default value of
> $EDITOR, it's necessary to enumerate the pros and cons.  Would you be
> able to help by working through and listing all the positives and
> negatives or each possibility; and even any other possibilities you
> can think of.
> I'd certainly agree that historically the 'vi' in 'visudo' was 'vi'.
> On Sun, 23 Dec 2012, Felix Miata wrote:
>> Many will never get anything useful done in vi(m), or even figure
>> out how to exit it except by kill or CAD.
> I believe one of the reasons why Nano is set as the initial boot
> default $EDITOR on Ubuntu installs is to cope with this reaction from
> first-time, or new users.  That's not to say the choice is correct, or
> unchangable.  The general argument, is that power-users, such as
> yourself Phil, are capable and able to search Google, and/or read
> documentation and from that run a command such as:
>   sudo update-alternatives --config editor
> ...Whereas a first-time Ubuntu user is in less of a position to find
> this.  They might even get stuck in a loop where even if they wanted
> to search the web, they might not be able to if they cannot configure
> the network if they are unfamiliar with the $EDITOR presented.

My original question was whether this was now standard Ubuntu policy to
default to nano rather than vim (vi) for visudo & by doing so making the
nano the default $EDITOR because I'd seen similar happen on the Red Hat
side & it was admitted it was a bug (next time I spin up a centos vm
I'll see if it's been fixed).

It may be also that I hadn't spotted this before because usually I clone
my $VIMRUNTIME from git (which has the $EDITOR default set in it
already) before I edit visudo. In this instance though, the first thing
I did after 'adduser' was call visudo so the variable would have been

As for the relevant merits of one editor over another, I'm too long in
the tooth to get into a discussion about that... unless, of course, it
happens to turn out to be emacssudo ;-)



currently (ab)using
CentOS 5.8 & 6.3, Debian Squeeze & Wheezy, Fedora Beefy & Spherical,
Lubuntu 12.10, OS X Snow Leopard & Ubuntu Precise & Quantal

More information about the ubuntu-users mailing list