如何在 git bash commit 中保存退出 vim

How to save exit nvim in git bash commit

我在 Win 10 上使用 git bash 和 nvim 作为编辑器。当我提交但没有消息时,它会打开一个空白屏幕(其中空白表示空白,而不是底部有行号的大部分空白),我键入 "stuff",我 Esc:wq 但是插入了 "wq"。我 并得到强制性的 you're-an-idiot-and-didn't-give-a-commit-message 错误。我直接启动 nvim 并得到相同的空白屏幕和相同的效果,只有在 未插入后任何命令的第一个字符,然后我们立即返回插入模式,所以 :q 表现得像 iq ... 完全不知所措。 git bash 与 nvim 不兼容吗?

编辑:以防视觉帮助

neovim/neovim issue 9585 说明 nvim 可以与 Git 一起使用。

检查 git config core.editor 如何将 nvim 声明为 Git 编辑器。

可以是:

git config --global core.editor '"nvim -u NORC"'

在 Windows 上,this issue 建议:

git config --global core.editor "set LC_CTYPE='en_US.UTF-8';nvim"

使用 mhinz/neovim-remote 可以帮助:

git 配置 --global core.editor 'nvr --remote-wait-silent'