Ever start up your system and trying to perform an action (like visudo) only to find that your systems opens nano, and you absolutely loathe it? Sure you could remove the packages entirely, but on shared systems this can sometimes be unavailable options.

Luckily, Debian systems (including Ubuntu) make it easy to change which editor is the default for apps on yours system. Just use the update-alternatives command:

# update-alternatives --config editor

You will then be prompted for your editor selection:

There are 4 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/vim.basic 30 manual mode
4 /usr/bin/vim.tiny 10 manual mode

Press enter to keep the current choice[*], or type selection number:

In my case, I chose option 3, so I pressed 3, and then enter. And that's it! Visudo, svn, and all the others are now using vim instead of nano! Modify to taste.