How-To: Changing the default text editor

less than 1 minute read

There is a few software that will use the editor command to find out what text editor to use. Example commands will be dch to add a new .deb changelog entry, revision control softwares when prompting for a commit message …

There is basically 2 ways for changing the default editor:

  • System wide
  • At user level

1. System Wide

Run:

$ sudo update-alternatives --config editor

And then choose whichever editor you want to be default.

2. User Level

As a user, you cannot change the setting for the whole system, but you can add an alias for editor to let say vim.

Open and edit ~/.bashrc and add:

alias editor=vim

Next time you will open a bash prompt, your default editor will be vim.

Hope that helps!