Feeds:
Posts
Comments

Archive for the ‘Linux Command Line’ Category

Some distros, the default editor is Nano and some is vi. I like vim, may be other users like emacs or atom.
So, how to change our preferred editor become the default text editor?

From your Linux terminal, type:

$ update-alternatives --list editor
/bin/ed
/bin/nano
/usr/bin/mcedit
/usr/bin/vim.basic
/usr/bin/vim.tiny

It will display any editor installed in your system.

To change the default editor, type:

$ 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 enter to keep the current choice[*], or type selection number:

editor01
For example, from nano, I want to change to vim.

$ sudo 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 enter to keep the current choice[*], or type selection number:
$

Just press Enter to quit.
Now, my default editor is vim.
editor02

Read Full Post »