Debian/Ubuntu has a number of chores for which the application to use for that chore can be configured by you. Editor and pager are 2 of the most common and generally I’ve set the environment variables for those in the past. Setting EDITOR and PAGER determines what happens when an application puts you into a page mode or which an application requires that you edit something.
Debian/Ubuntu though has a system for determining what application should be used in that instance, the
ls -l /usr/bin | grep 'alternative' will show you all the programs that are linked to the
/etc/alternatives directory. The
/etc/alternatives dir in turn has symlinks that point to the application choices a user configures.
update-alternatives is the program which manipulates the symlinks in the
/etc/alternatives directory. Running
sudo update-alternatives --config editor will give you a menu from which you can choose your favorite editor.