debianのデフォルトエディターを変える

aptやcvsなどで呼び出されるエディターはデフォルト登録をされたエディターになっている。これを帰るには以下のようにする。

 # update-alternatives --config editor
 
 There are 5 alternatives which provide `editor'.
 
   Selection    Alternative
 ------------------------------------------------
       1        /bin/ed
 *+    2        /bin/nano
       3        /usr/bin/nvi
       4        /usr/bin/emacs21
       5        /usr/bin/vim
 
 Press enter to keep the default[*], or type selection number: 5 <-- 数値を入力する