Changing Debian’s sensible-editor
Debian uses the symlink /usr/bin/sensible-editor to point to the default text editor to use. This is controlled by the Debian Alternatives system, which will work automatically if you want it to. If, however, you want to change the auto-selected "sensible editor", you can do so with this command:
sudo update-alternatives --config editor
This will let you select one of your installed text editors from a list that will look something like this:
There are 5 alternatives which provide `editor'.
Selection Alternative
-----------------------------------------------
1 /bin/ed
+ 2 /bin/nano
3 /usr/bin/vim.tiny
4 /usr/bin/mcedit-debian
* 5 /usr/bin/vim.basic
Press enter to keep the default[*], or type selection number:
The "+" indicates the editor that would be selected if Debian had to choose, the "*" indicates your current choice.
Debian also maintains symlinks for sensible-browser and sensible-pager. You can change those easily as well:
sudo update-alternatives --config x-www-browser sudo update-alternatives --config pager
If you find that your favorite program is not included in the list (most likely because it wasn't installed from a .deb package), you can add it like so:
sudo update-alternatives --install x-www-browser x-www-browser /usr/local/src/firefox/firefox 900
In English, this means install into the category x-www-browser, using the symlink named x-www-browser (found in /etc/alternatives), which points to the binary at /usr/local/src/firefox/firefox, and give it a numerical priority of 900. The priority determines which program Debian would select if set to auto. The largest number wins. This is how I added firefox into the list of potential sensible-browser selections.