Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
44
rated 0 times [  44] [ 0]  / answers: 1 / hits: 33131  / 3 Years ago, sat, september 25, 2021, 10:00:28

I'm trying to use sudoedit, but it keeps running the nano editor. My preferred editor is vim. How can I make it the default?



Looking at the man page, man sudoedit, I've noticed the following:



 EDITOR           Default editor to use in -e (sudoedit) mode if neither SUDO_EDITOR nor VISUAL is set.
SUDO_EDITOR Default editor to use in -e (sudoedit) mode.
VISUAL Default editor to use in -e (sudoedit) mode if SUDO_EDITOR is not set.


So I've set them all to /usr/bin/vim, but sudoedit /etc/hosts still uses nano. Am I missing something?



$ EDITOR=/usr/bin/vim
$ VISUAL=/usr/bin/vim
$ SUDO_EDITOR=/usr/bin/vim

$ echo $VISUAL
/usr/bin/vim

$ echo $EDITOR
/usr/bin/vim

$ echo $SUDO_EDITOR
/usr/bin/vim

$ sudoedit /etc/hosts # This is still using nano

More From » text-editor

 Answers
0

Run sudo update-alternatives --config editor and choose for vim. After this, sudoedit /etc/hosts should open /etc/hosts using vim.



Alternatively you can use sudo vim /etc/hosts.


[#25697] Sunday, September 26, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rontablis

Total Points: 293
Total Questions: 123
Total Answers: 104

Location: Austria
Member since Mon, Mar 1, 2021
3 Years ago
;