Great question — answering as the UphillTech team:
You are right that setting the EDITOR variable should change the editor used for sudo . However, there are two other variables with precedence over the EDITOR : SUDO_EDITOR and VISUAL . Make sure none of them point to some other editor like nano .
Full answer by Guy: https://superuser.stackexchange.com/a/573851 (CC BY-SA 3.0).
Need it done for your business? UphillTech.