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


当前回答

在Git配置中设置core.editor:

git config --global core.editor "nano"

设置GIT_EDITOR环境变量:

export GIT_EDITOR=nano

其他回答

对于希望将neovim与Windows Subsystem For Linux一起使用的Windows用户:

git-config-core.editor“C:\Windows/system32/bash.exe--login-C'nvim.git/COMMIT_EDITMSG'”

这不是一个傻瓜式的解决方案,因为它不处理交互式的重新基础(例如)。非常欢迎改进!

对于Windows,Neovim:

# .gitconfig

[core]
    editor='C:/tools/neovim/Neovim/bin/nvim-qt.exe'

在Git配置中设置core.editor:

git config --global core.editor "nano"

设置GIT_EDITOR环境变量:

export GIT_EDITOR=nano

在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"

对于EmEditor用户

要将EmEditor设置为Git的默认文本编辑器,请打开Git Bash,然后键入:

git config--全局core.editor“emeditor.exe-sp”

需要EmEditor v19.9.2或更高版本。