How to Set a Different Editor for visudo
Sometimes, visudo
does not respect the EDITOR
environment variable. To
change the editor in any case, add the following to the visudo
file:
Defaults editor=/usr/local/bin/nvim
Of course, change /usr/local/bin/nvim
to your preferred editor.