How to change the default editor

From Cosmin's Wiki

Jump to: navigation, search

Home > Linux how to's > How to change the default editor



Linux operating systems come with a default editor. Debian Etch comes with nano as default editor.

If you are the system's administrator and you want to change the default editor for everybody, all you need to do is:

# update-alternatives --config editor

which will open a screen with all available options:

There are 5 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/mcedit-debian

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

If you are just a regular user and you wish to change the default editor, you can define the EDITOR environment variable by introducing the following lines in your own profile:

EDITOR=vim
export EDITOR
alias editor=$EDITOR