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


当前回答

对于emacs用户

.emacs:

(server-start)

外壳:

export EDITOR=emacsclient

其他回答

在Mac OSX 10中将Sublime Text 2设置为Git提交编辑器

运行以下命令:

$ git config --global core.editor "/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"

或者只是:

$ git config --global core.editor "subl -w"

Mvim作为您的git编辑器

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

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

对于Textmate用户

这将在您想要编辑提交时打开Textmate编辑器。需要安装textmate命令行工具。

git-config--全局core.editor“mate-w”

在Git配置中设置core.editor:

git config --global core.editor "nano"

设置GIT_EDITOR环境变量:

export GIT_EDITOR=nano

Run:

git config --global core.editor "vim"

来自man git commit:

环境和配置变量用于编辑提交日志消息的编辑器将从GIT_editor环境变量、core.editor配置变量、VISUAL环境变量或editor环境变数中选择(按顺序)。