October 10, 2022, 12:56pm
/etc/environment file contains the following lines:
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?
micro editor is installed and on the path:
~> whereis micro
micro: /usr/bin/micro /usr/share/man/man1/micro.1.gz
The output of
printenv looks correct:
~> printenv | grep micro
And the problem happens even if I inline the environment variable:
~> env EDITOR=micro edit tmp
still opens in
October 10, 2022, 1:00pm
First, welcome to the forum!
edit is a program that is part of
vi. Since you are explicitly running the program
edit, it will always open in
October 10, 2022, 1:03pm
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?
October 10, 2022, 1:13pm
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.
October 12, 2022, 1:14pm
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.