Nick Vanderbilt
Nick Vanderbilt

Reputation: 38540

GIT_EDITOR not working with macvim

This is what I have in my ~/.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

$ git commit
Aborting commit due to empty commit message.

If I use change GIT_EDITOR to use textmate then things work fine

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.

Upvotes: 46

Views: 10025

Answers (4)

Jacob Horbulyk
Jacob Horbulyk

Reputation: 2646

I had a similar problem. Adding the --noplungin flag to vim solved it for me.

Upvotes: 0

9monkeys
9monkeys

Reputation: 1804

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:

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

Upvotes: 38

mraaroncruz
mraaroncruz

Reputation: 3809

This worked great for me.
git config --global core.editor 'mvim -f --nomru -c "au VimLeave * !open -a iTerm"'
If you are using Terminal.app instead of iTerm.app you 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)

Upvotes: 12

CB Bailey
CB Bailey

Reputation: 793269

You need to supply the -f option to vim to ensure that it doesn't background itself.

Upvotes: 69

Related Questions