zsh fix not working inside thunderbird's external editor

67 views
Skip to first unread message

Penny Leach

unread,
Jul 5, 2012, 3:29:35 PM7/5/12
to vim_mac
Hi there,

I found the fix for the zsh problem in the troubleshooting page on the
wiki and it works perfectly for me if I launch macvim in any sort of
ordinary way. However, I'm using the external editor plugin for
Thunderbird, and when it launches macvim, the PATH variable is not set
properly.

The launch command for the thunderbird plugin is: /Applications/
MacVim.app/Contents/MacOS/Vim -g --nofork

I don't see any good reason for this to cause the zsh variables to not
be read, any insight would be appreciated.

Thanks,
Penny

björn

unread,
Jul 10, 2012, 4:59:51 PM7/10/12
to vim...@googlegroups.com
Hi,

I'm afraid I don't use zsh so can not really contribute at all to this
thread. Normally my response would be to ask on vim_use but this
really is specific to the Mac so I don't think you'll get much help
there.

Are there no zsh users on this list that have a clue what's going on here?

Björn

Ben Schmidt

unread,
Jul 15, 2012, 7:44:29 PM7/15/12
to vim...@googlegroups.com, Penny Leach
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.



Penny Leach

unread,
Jul 17, 2012, 3:20:02 AM7/17/12
to vim...@googlegroups.com
On Monday, July 16, 2012 1:44:29 AM UTC+2, Ben Schmidt wrote:
> 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.


Yay! That worked perfectly. I experimented a little bit trying to find
another way to do it but failed so I will just stick with your solution.
Thanks very much!

Penny

Reply all
Reply to author
Forward
0 new messages