Loading ...
Sorry, an error occurred while loading the content.
 

Re: zsh fix not working inside thunderbird's external editor

Expand Messages
  • Ben Schmidt
    ... 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
    Message 1 of 4 , Jul 15, 2012
      On 6/07/12 5:29 AM, Penny Leach wrote:
      > 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

      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.



      --
      You received this message from the "vim_mac" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Penny Leach
      ... 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
      Message 2 of 4 , Jul 17, 2012
        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

        --
        You received this message from the "vim_mac" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      Your message has been successfully submitted and would be delivered to recipients shortly.