macosbashshellbash-it

Some bash variables are being overwritten


I am using bash-it in my Mac OSX terminal. However, lately i have been having problems related to the EDITOR and GIT_EDITOR variables.

In a custom bash file i set those variables clearly via:

# Make Sublime the default editor
export EDITOR="subl";
export GIT_EDITOR="subl --wait";

However, something is overwriting those variables as when i do export -p the values assigned are:

declare -x EDITOR=" -w"
declare -x GIT_EDITOR=" -w"

I have checked the other sourced files to see if they are being overwritten by a plugin somewhere but with no luck.

Would appreciate any pointers on how to debug and fix this.

Thanks


Solution

  • This is caused by having Bash-it's textmate plugin enabled. It tries to define the EDITOR and GIT_EDITOR variables based on your local textmate installation:

    export EDITOR="$(which mate) -w"
    export GIT_EDITOR=$EDITOR
    

    If you don't have the mate command on your path, if will set the variables to what you have seen, just -w. This is an error in Bash-it, there should be an if statement around these definitions. I have created a pull request to fix that.

    If you're not using TextMate, simply disable the textmate plugin:

    bash-it disable plugin textmate
    

    Then open a new shell window, and you should be all set.