Change default editor in Debian


# update-alternatives --config editor

There are 7 alternatives which provide `editor'.

Selection Alternative
-----------------------------------------------
1 /bin/ed
+ 2 /bin/nano
3 /usr/bin/vim.tiny
* 4 /usr/bin/vim.basic
5 /usr/bin/nedit
6 /usr/bin/emacs21
7 /usr/bin/xemacs21

Press enter to keep the default[*], or type selection number: 6