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
sudo vim
?visudo: /etc/sudoers: Permission denied
. What is that?visudo
is a different program. It's just there to allow you toedit the sudoers file
.man visudo
sudo vim
, I am just asking how can usevim
withsudoedit
instead ofnano
.