My /etc/environment file contains the following lines:
EDITOR=micro
SUDO_EDITOR=micro
VISUAL=micro
However, running edit tmp opens a temporary file in the vi editor instead of micro, even after a reboot, and regardless of which shell I use (fish or bash). How do I fix this?
Aha, that’s confusing, I always assumed edit was just the non-sudo equivalent of sudoedit. Thank you. Is there a generic edit command that will always use my chosen EDITOR? Should I just use the ef function defined in the default .bashrc for this?
To be honest, I am a bit confused as to why you would need that. The purpose of those variables is so that programs that use an editor know which editor you prefer.
If you just want to open a file directly, why not just call the editor directly? Presumably you know what your preferred editor is.
That being said, you could easily create a function in your bashrc or a shell script that would do that.