2011-01-19 38 views
39

工作這是我在我的〜/ .bashrcGIT_EDITOR不是的MacVim

export GIT_EDITOR='/Applications/MacVim.app/Contents/MacOS/Vim -g ' 

當我發出

git commit 

然後我得到的MacVim編輯器,但在命令行中我看到這個消息

$ git commit 
Aborting commit due to empty commit message. 

如果我使用變化GIT_EDITOR使用TextMate的那麼事情做工精細

export GIT_EDITOR='/usr/local/bin/mate -w' 

我不想使用textmate。我想使用macvim。我正在使用mac並使用bash。

回答

65

您需要提供-f選項給vim以確保它不會自己背景。

+0

這就像魅力。謝謝 – 2011-01-19 16:29:16

+0

當然!非常感謝。 – 2012-07-04 20:06:18

7

這對我很好。
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)

34

我有同樣的問題。我固定它通過運行在命令行下面的設置mvim作爲默認編輯器的git:

git config --global core.editor "mvim -f" 
0

我也有類似的問題。給vim添加--noplungin標誌爲我解決了它。