The easiest way is to change the environment variable EDITOR to point to mate. In your .bash_profile
add the following:
export EDITOR="/usr/local/bin/mate -w"
and re-start your terminal session, or source the .bash_profile
.
As for your error message:
error: More than one value for the key core.editor: mate
it means you've added multiple core.editor lines in your .gitconfig.
Use mate ~/.gitconfig
to modify your .gitconfig
and remove the extra lines, or if you don't mind unsetting all of them use:
git config --global --unset-all core.editor
Then use
git config --global --add core.editor "/usr/local/bin/mate -w"
then you can leave $EDITOR
set to what it was previously set to.
If mate
is not located in /usr/local/bin
find where it is first by using type mate
(in bash, not sure about other shells)
Since you want to use open
as your $GIT_EDITOR
you will need the following:
-W Causes open to wait until the applications it opens (or that were already open) have exited. Use with the -n flag to allow open to function as an appropriate app for the $EDITOR environment variable.
-n Open a new instance of the application(s) even if one is already running.
This will work for that:
git config --global --unset-all core.editor
git config --global --add core.editor "open -W -n"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…