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
? – Cornelius Apr 24 '14 at 17:35visudo: /etc/sudoers: Permission denied
. What is that? – Cornelius Apr 24 '14 at 17:38visudo
is a different program. It's just there to allow you toedit the sudoers file
.man visudo
– Dan Apr 24 '14 at 17:38sudo vim
is insecure. You're giving your vim plugins sudo access. – Mateen Ulhaq Aug 26 '17 at 05:32sudo vim
, I am just asking how can usevim
withsudoedit
instead ofnano
. – Dan Aug 29 '17 at 12:34