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


当前回答

对于Windows,Neovim:

# .gitconfig

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

其他回答

对于EmEditor用户

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

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

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

要使Visual Studio代码(vscode)成为默认的git编辑器,请执行以下操作:

git config --global core.editor "code --wait"

有一个命令列表,您可以使用,但对于vs代码,请使用此命令

 git config --global core.editor "code --wait"

这是所有编辑器的链接:https://git-scm.com/book/en/v2/Appendix-C%3A-Git命令设置和配置

对于Windows,Neovim:

# .gitconfig

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

Run:

git config --global core.editor "vim"

来自man git commit:

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