如何全局配置git以使用特定的编辑器(例如vim)提交消息?


当前回答

Mvim作为您的git编辑器

与所有其他GUI应用程序一样,您必须使用wait标志启动mvim。

git config --global core.editor "mvim --remote-wait"

其他回答

只需尝试EDITOR=vim-gitcommit。

或者可以通过在bashrc中导出EDITOR=vim将EDITOR设置为vim。

对于Mac OS X,使用TextEdit或自然环境编辑器编辑文本:

git config --global core.editor "open -W -n"

对于emacs用户

.emacs:

(server-start)

外壳:

export EDITOR=emacsclient

在Git配置中设置core.editor:

git config --global core.editor "nano"

设置GIT_EDITOR环境变量:

export GIT_EDITOR=nano

在macOS Big Sur(11.0)测试版上,TextMate:所有环境变量选项都无效。(设置所有三个:GIT_EDITOR、VISUAL和EDITOR。)

最后,在git中设置全局core.editor,这起到了作用:git-config--全局core.editor“~/bin/mate-w”