views:

43

answers:

1

I'm trying to use MacVim as a default editor (on my Mac, obviously). I'd like to have MacVim to edit commit messages when I hg ci. Unfortunately when I do so (either by setting EDITOR=mvim or alias vi='mvim') MacVim pops up with an empty message (i.e. none of the boilerplate in the bottom half), and when I save that commit message I get the error "abort: empty commit message".

Is there a way to use MacVim (presumably via mvim) to edit the commit messages when checking in changes with Mercurial?

Thank you for reading, and I look forward to reading the answers.

Brian

+3  A: 

Set EDITOR='mvim -f', per the tip from the FAQ for making it work with Git:

How can I use MacVim to edit Git commit messages?

Add the following line to the file ~/.profile:

export EDITOR='mvim -f -c "au VimLeave * !open -a Terminal"'

The last part ensures that Terminal gets focus again after closing the commit message. (Note that you need to put the mvim script in your path for this to work.)

Jeremy W. Sherman
So the answer was really to use Git. Clearly it has the superior FAQ. hehe.
Brian M. Hunt
Incidentally, the `export EDITOR='...'` expands to `mvim -f -c "au VimLeave Desktop Documents Downloads Library Movies Music Pictures Public Sites bin !open -a Terminal"`. I'm not sure if that's the anticipated/desired behaviour. I added `set -f` to the script right before the `export` to prevent the glob.
Brian M. Hunt
@Roger Pate: I agree, it seems quite weird. I've started a new question to see if the answer can be rooted out: http://stackoverflow.com/questions/4052593/mac-os-x-bash-default-pathname-expansion-or-bug
Brian M. Hunt
@Brian: I forgot there was an important third option: I'm misunderstanding what's happening and tested with what I thought was equivalent, but wasn't. Deleting those comments.
Roger Pate
@Roger Pate: No problem!
Brian M. Hunt