bash GIT_EDITOR 不适用于 macvim
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4737381/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GIT_EDITOR not working with macvim
提问by Nick Vanderbilt
This is what I have in my ~/.bashrc
这就是我的 ~/.bashrc
export GIT_EDITOR='/Applications/MacVim.app/Contents/MacOS/Vim -g '
When I issue
当我发出
git commit
then I get a macvim editor but on the command line I see this message
然后我得到了一个 macvim 编辑器,但在命令行上我看到了这条消息
$ git commit
Aborting commit due to empty commit message.
If I use change GIT_EDITOR to use textmate then things work fine
如果我使用更改 GIT_EDITOR 来使用 textmate 那么一切都很好
export GIT_EDITOR='/usr/local/bin/mate -w'
I don't want to use textmate. I want to use macvim. I am using mac and use bash.
我不想使用 textmate。我想使用 macvim。我正在使用 mac 并使用 bash。
回答by CB Bailey
You need to supply the -foption to vim to ensure that it doesn't background itself.
您需要为-fvim提供该选项以确保它本身不会成为背景。
回答by 9monkeys
I had the same problem. I fixed it by setting mvim as the default editor for git by running the following from the command line:
我有同样的问题。我通过从命令行运行以下命令将 mvim 设置为 git 的默认编辑器来修复它:
git config --global core.editor "mvim -f"
回答by mraaroncruz
This worked great for me.git config --global core.editor 'mvim -f --nomru -c "au VimLeave * !open -a iTerm"'
If you are using Terminal.appinstead of iTerm.appyou can just switch it out.
Source: https://github.com/b4winckler/macvim/wiki/FAQ(though they are using the EDITOR env variable instead of the gitconfig)
这对我很有用。git config --global core.editor 'mvim -f --nomru -c "au VimLeave * !open -a iTerm"'
如果你正在使用Terminal.app而不是iTerm.app你可以把它关掉。来源:https: //github.com/b4winckler/macvim/wiki/FAQ(尽管他们使用的是 EDITOR env 变量而不是 gitconfig)
回答by Jacob Horbulyk
I had a similar problem. Adding the --noplunginflag to vim solved it for me.
我有一个类似的问题。将--noplungin标志添加到 vim 为我解决了这个问题。

