EDITOR is not getting set or is getting overwritten after being set


I have my EDITOR set to vim in my ~/.bash_profile, and it's being overwritten somewhere to nano.

Every time I go to make a git commit, I'm being given nano instead of vim, very frustrating.

I just noticed the ~/usr/share/doc... and changed it to /usr/share/doc...

echo $EDITOR
echo $EDIT


Check .profile /etc/environment aswell.

echo $EDITOR
echo $EDIT

nano like I said and nothing

.profile /etc/environment

both empty

If you're running Manjaro, try setting EDITOR like I have in ~/.bash_profile . Then see if the setting sticks or not. For me, it's not.

Um, just because you set it to vim in your root account doesn't mean it'll be set to vim in your regular user account. Your screenshot shows that you are editing as root.

Also, perhaps it'll help if you remove the quotes around vim, like so... :arrow_lower_left:

export EDITOR=vim

That's screen saying the first window is logged in as root, not the current window. It's logged in as a regular user.

Did you try setting EDITOR in your ~/.bash_profile to see if it sticks or not?

xircon Aragorn

Did either of you try setting EDITOR in your own ~/.bash_profile to see if the setting sticks or is overwritten with nano?

I use nano, and I have it set to nano in my ~/.bash_profile, because the default on my system was emacs. And setting it to nano works. However, I've decoupled the commands. Instead of...

export EDITOR=nano

... I have...

export EDITOR

Also ─ I don't know whether you've done this ─ you need to log out completely and back in before the setting takes effect.

Check /etc/xdg/plasma-workspace/env/envars.sh, EDITOR variable get's set there.


I've rebooted several times, and it does not take effect, so logging out and back in will make no difference.

The default setting in Manjaro is EDITOR set to nano, so setting it again won't help solve this bug. Try setting it to vim just as a test. After you tested whether that works, just set it back to nano please.



at the bottom of .bashrc worked fine.
Though I usually set these higher up in /etc/environment
And also remember there is more than 1 .. there is EDITOR, SUDO_EDITOR, VISUAL

.bashrc is not the correct place to set environment variables. This thread is already solved.

....its a fine enough place to set them if you desire.
But as my post indicates .. I prefer not to. I like them in /etc/environment if I want them system-wide.
(and just about no one sets them in /etc/xdg/plasma-workspace/env/envars.sh .. that is funky and might be overridden by an update)

Is it? The selected solve simply indicates where the default is set, not where you should set changes.
And just to be clear ... you are the one that necro'd this thread a month later :wink:

Don't be an idiot.


Quick guide

For the hasty who just need to get the system running, here is what you can do:

  • Put all global environment variables, i.e. ones affecting all users, into /etc/environment
    • Remember, this file is read by PAM, not by a shell. You cannot use shell expansions here. E.g. MAIL=$HOME/Maildir/ will not work!
    • There is no shell-agnostic and login-independent solution to the problem of how to configure the environment for all users, beyond the trivial cases that PAM can handle.
  • Put all your transient shell settings (aliases, functions, shell options) in ~/.bashrc
  • Put all your environment variables in ~/.profile
  • Create or edit file ~/.bash_profile and include commands:

...er ... right back at you ?

It clearly states that bashrc is fine for certain variables, and mentions global ones could be put in other places like /etc/environment as I have now repeated 3 times.

Do you want more docs? How about the tutorial I wrote so that this thread never needed to exist?

Dude get out of my thread. Quit necromancing. This was already solved, and now you are just trolling.

Again .. I didnt necro anything .. you did, and called me an idiot to boot.


If you are still having trouble .. take a look at the tutorial link I posted above.


Solved one way or another.

Forum kindly sponsored by