Today i installed Ubuntu 16.04 on my new laptop and i faced issues while editing because ubuntu default editor is nano, I am more comfortable with vim editor which has more features and flexible as compared to any other linux command-line editor.So i thought why not change default editor in Ubuntu 16.04.In this post we will see HowTo change default editor in Ubuntu 16.04

For this post, we are using below setup.


root@jarvis:~# uname  -r
root@jarvis:~# lsb_release -d
Description:	Ubuntu 16.04.3 LTS

Now when we run visudo command to edit sudo privilege, we will see nano editor for change in /etc/sudoers file. So i like to change it to vim editor for better features.










For changing linux default editor, we have to run below command and select editor as mentioned below.

root@jarvis:~# update-alternatives --config editor
There are 5 choices for the alternative editor (providing /usr/bin/editor).

  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/mcedit      25        manual mode
  4            /usr/bin/vim.basic   30        manual mode
  5            /usr/bin/vim.tiny    10        manual mode

Press  to keep the current choice[*], or type selection number: 4
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode

This way Default Ubuntu has got changed to vim and now visuo command will open /etc/sudoers in vim editor as compared to nano.