How can I change the default text editor for console programs in Ubuntu.
When I run mutt and send a message, it currently loads up Joe and I would prefet to load Vim.
I know I can change $EDITOR for me only, but would prefe to do it system wide.
Linux – How to change the default text editor in Ubuntu
linuxtext-editorsUbuntu
Best Answer
You can change $EDITOR systemwide. Just drop a short script into
/etc/profile.d/
which does this. The file only needs a single line:Edit:
There are two ways (at least :-/) in which a program can find an editor to launch. The traditional Unix/Linux mechanism is to use $EDITOR. In addition to that, Debian (and therefore Ubuntu) has special aliases for various kinds of programs. These are provided by the "alternatives" system (a system of configurable symlinks). For editors this provides the aliases
editor
andsensible-editor
. These can be updated using update-alternatives:(same for sensible-editor). This will prompt you for the editor to use.
However, in Debian programs are suppposed to read $EDITOR first:
[...]
(Debian Policy Manual, http://www.debian.org/doc/debian-policy/ch-customized-programs.html#s11.4 )
In one sentence: Setting $EDITOR globally should be enough.