Update default editor for sudoedit to vim

 

sudoedit is a command to edit other user/root files. By default editor for sudoedit command is nano editor. I am not much familiar with nano editor very well, so I thought to change the default editor form nano to vim.

Following is the procedure to update editor:

we need to use update-alternatives command to do modifications.

$ sudo update-alternatives –config editor
The above command will show some options as shown below

There are 3 choices for the alternative editor (providing /usr/bin/editor).

Selection    Path                Priority   Status
————————————————————
* 0            /bin/nano            40        auto mode
1            /bin/nano            40        manual mode
2            /usr/bin/vim.basic   30        manual mode
3            /usr/bin/vim.tiny    10        manual mode

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

where * stands for default editor.

Here select and type the number related to vim editor, then press enter that will update the default editor.

To conform about modifications again run the update-alternatives command.

$ sudo update-alternatives –config editor
There are 3 choices for the alternative editor (providing /usr/bin/editor).

Selection    Path                Priority   Status
————————————————————
0            /bin/nano            40        auto mode
1            /bin/nano            40        manual mode
* 2            /usr/bin/vim.basic   30        manual mode
3            /usr/bin/vim.tiny    10        manual mode

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

We can conform that the editor is changed form nano to vim.basic

-Sany

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s