This doesn't work because starting a MacVim instance using the Vim
executable directly, or the mvim script, inherits the environment of the
caller. It doesn't go through the login shell like when using the New
Window menu command inside MacVim.
I get around this by means of a wrapper script that runs MacVim in a
login shell. My script is /Users/ben/bin/loginvim:
#!/bin/bash -l
/usr/local/bin/mvim "$@"
mvim is from the MacVim distribution, but installed to /usr/local.
Notice the -l argument to bash on the shebang line makes bash act as a
login shell when the script is executed and it therefore sources all the
relevant login scripts, like in Terminal.app or MacVim's New Window menu
command.
I then have Thunderbird's External Editor extension set to execute
/Users/ben/bin/loginvim -f and it works just fine.
After a bit of experimentation, I think the following will work for zsh.
It's a bit nasty (shells everywhere) but login was crashing when I used
it in a shebang line, so I had to do this:
#!/bin/sh
/usr/bin/login -f "$USER" /bin/zsh /usr/local/bin/mvim "$@"
You or someone else might know of some other magic, though. I'm not
really familiar with zsh, so I'm just feeling my way around.
Cheers,
Ben.