我是一个笨拙的打字员,我不经常使用vi/vim,但我确实用它来提交消息.但是,如果您在编辑提交消息时键入错误的命令(:Wq例如,而不是:wq),当您使用:wq或正确关闭vim中的提交消息时:x,您会得到:
error: There was a problem with the editor 'vi'.
Please supply the message using either -m or -F option.
Run Code Online (Sandbox Code Playgroud)
通常情况下,像一个错误的命令:W是没有问题的,只是VIM忽略它,你可以保持在与该文件的工作,并保存它,但在git的,只要我输错犯的消息,我都付诸东流提交信息.
这里发生了什么,我该如何解决?(使用git 1.9.1通过自制程序,vim 7.3与OS X 10.9一起打包)
Ali*_*iou 29
你应该将vim设置为不与shell分离并位于前台.您可以使用以下命令执行此操作:
git config --global core.editor vim -f
Run Code Online (Sandbox Code Playgroud)
来自男人:
-f Foreground. For the GUI version, Vim will not fork and detach from the shell it
was started in. On the Amiga, Vim is not restarted to open a new window. This
option should be used when Vim is executed by a program that will wait for the
edit session to finish (e.g. mail). On the Amiga the ":sh" and ":!" commands
will not work.
Run Code Online (Sandbox Code Playgroud)