Investigate and switch it back to the distro default.
Description
Details
Related Objects
Event Timeline
On tools-web-static-02 (as an example of a recently created instance) it isn't:
scfc@tools-web-static-02:~$ sudo update-alternatives --config editor There are 5 choices for the alternative editor (providing /usr/bin/editor). Selection Path Priority Status ------------------------------------------------------------ * 0 /bin/nano 40 auto mode 1 /bin/ed -100 manual mode 2 /bin/nano 40 manual mode 3 /usr/bin/emacs23 0 manual mode 4 /usr/bin/vim.basic 30 manual mode 5 /usr/bin/vim.tiny 10 manual mode Press enter to keep the current choice[*], or type selection number: scfc@tools-web-static-02:~$
I assume @valhallasw is correct in that it might be related to the order in which packages are installed (or not). But resolving this would probably require determining which editor is to be recommended and which are not, while probably the first action of most users that encounter any "default" editor is to set their own customization:
scfc@tools-web-static-02:~$ sudo find /home -mindepth 2 -maxdepth 2 -type f -name .selected_editor | wc -l 89 scfc@tools-web-static-02:~$
(Yes, that's not all 759, but the "default editor" is probably only executed and thus the need for customization only arises when calling crontab -e and similar commands; others will just say vim file.txt.)
So before we spend too much time guessing which editor suits our users' needs best, let us just let them decide and point them to select-editor if necessary :-).
Reopening this. For some reason, git starts joe (as valhallasw, on both tools-bastion-02 and -03) even though my
valhallasw@tools-bastion-03:~/src/pywikibot-core$ cat ~/.selected_editor # Generated by /usr/bin/select-editor SELECTED_EDITOR="/usr/bin/vim.tiny"
In any case, having Joe as fallback is not a great choice -- nano and mcedit are both much better, as they show which keys to use for a given command.
I have asked @Giftpflanze if they still use Joe, since they requested it. If they aren't I'm considering just uninstalling it...
Just typing editor in a shell prompt brings up joe, which on further investigation:
tom29739@tools-bastion-03:~$ type editor editor is /usr/bin/editor tom29739@tools-bastion-03:~$ file /usr/bin/editor /usr/bin/editor: symbolic link to `/etc/alternatives/editor' tom29739@tools-bastion-03:~$ file /etc/alternatives/editor /etc/alternatives/editor: symbolic link to `/usr/bin/joe'
According to the git docs (https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration), "By default, Git uses whatever you’ve set as your default text editor ($VISUAL or $EDITOR) or else falls back to the vi editor to create and edit your commit and tag messages."
I set these in my .profile a few months ago in the hope that it would get rid of joe, and it works:
# Set default editor export VISUAL=vim.basic export EDITOR=vim.basic
git now launches vim (my preferred editor) when I commit. I also found this when looking through the select-editor man page: "SELECTED_EDITOR is overridden by the VISUAL and EDITOR environment variables."
Perhaps instead of using vi like the git docs suggests it does as a fallback, it's using the editor command or similar instead?
Well-spotted. Debian passes DEFAULT_EDITOR=editor in the build process, which overrides the choice of vi as default editor.
update-alternatives --config editor
example of the command above from my laptop:
There are 5 choices for the alternative editor (providing /usr/bin/editor). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/vim.gnome 60 auto mode 1 /bin/nano 40 manual mode 2 /usr/bin/vim.basic 30 manual mode 3 /usr/bin/vim.gnome 60 manual mode 4 /usr/bin/vim.nox 40 manual mode 5 /usr/bin/vim.tiny 10 manual mode
tom29739@tools-bastion-03:~$ update-alternatives --config editor There are 12 choices for the alternative editor (providing /usr/bin/editor). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/joe 70 auto mode 1 /bin/ed -100 manual mode 2 /bin/nano 40 manual mode 3 /usr/bin/emacs23 0 manual mode 4 /usr/bin/emacs24 0 manual mode 5 /usr/bin/jmacs 50 manual mode 6 /usr/bin/joe 70 manual mode 7 /usr/bin/jpico 50 manual mode 8 /usr/bin/jstar 50 manual mode 9 /usr/bin/mcedit 25 manual mode 10 /usr/bin/rjoe 25 manual mode 11 /usr/bin/vim.basic 30 manual mode 12 /usr/bin/vim.tiny 10 manual mode Press enter to keep the current choice[*], or type selection number:
Yea, so anyone should be able to run that and pick the editor of their choice. Are we good then? Or do we want to reset it for everybody?
And it's a systemwide setting - individual users can always set EDITOR in their homedirs. It's just that joe is a terrible default.
from the manpage of update-alternatives:
"many systems have several text editors installed at once. This gives choice to the users of a system, allowing each to use a different editor, if desired, but makes it difficult for a program to make a good choice for an editor to invoke if the user has not specified a particular preference."
" Debian's alternatives system aims to solve this problem. A generic name in the filesystem is shared by all files providing inter‐changeable functionality. The alternatives system and the system administrator together determine which actual file is referenced by this generic name. For example, if the text editors ed(1) and nvi(1) are both installed on the system, the alternatives system will cause the generic name /usr/bin/editor to refer to /usr/bin/nvi by default. The system administrator can override this and
cause it to refer to /usr/bin/ed instead, and the alternatives system will not alter this setting until explicitly requested to do so."
Change 297435 had a related patch set uploaded (by Merlijn van Deen):
toollabs: set nano as default editor
Change 297437 had a related patch set uploaded (by Yuvipanda):
tools: Explicitly set nano to be default editor
Change 297437 abandoned by Yuvipanda:
tools: Explicitly set nano to be default editor