Change default editor in Ubuntu

Print

ubuntu-logo-smThere should a separate article on the "easiness" and "intuitiveness" of the NANO editor. Who would have thought that Ctrl+V stands for Next Page, Ctrl+C for Cur Pos (What is Cur Pos anyway?)? The person that says that this is intuitive should get shot. Completely ignoring well established norms of ALL editors (be it Windows, Mac or Linux) should be a punishable offense.

VI (or VIM) has one advantage over all *NIX editors - it's just there when you need it. No need to install, no matter what distribution or version - it's there. Whether you want it or not, you have to know at least the basic commands of VI. Forcing NANO on me and making me learn random key combinations is unacceptable.

I got distracted, however.

To select one of the more familiar editors in Ubuntu, you can run the following as root:

update-alternatives --config editor

which will produce the following window, allowing you to make a choice:

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

Lo and behold, you make the change and NANO editor is still your main one.

To solve this, you have to run the following:

export EDITOR=vim

To make it permanent, add this line to ~/.profile

export EDITOR=vim

 

Linux