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

regaining focus after calling MacVim from an external program

Expand Messages
  • Michael Dunn
    In the FAQ in the macvim help docs there s information on what to do if [y]ou have set MacVim to open from an external program and when you finish editing (by
    Message 1 of 5 , Oct 3, 2008
    • 0 Attachment
      In the FAQ in the macvim help docs there's information on what to do
      if "[y]ou have set MacVim to open from an external program and when
      you finish editing (by closing the MacVim window) you want the
      external program to regain focus". I use MacVim to edit text in
      Firefox by way of the "It's all Text!" plugin. The plugin requires
      that you specify the full path to the executable (I use the mvim
      script, e.g. /Users/misha/bin/mvim). However the plugin will not
      accept any arguments to this path, so the advice in the help document:

      mvim -c "au VimLeave * maca hide:"

      can't be followed. You probably don't want to add the autocommand to
      your .gvimrc, because that would make the hiding behaviour happen with
      any file. However, adding the following to your .gvimrc seems to be an
      acceptable solution:

      au VimLeave itsalltext/*.txt maca hide:

      The trick here is the path to the text file. If you search down in
      your ~/Library/ directory you'll find that "It's All Text" does all
      its work on temp files ending in ".txt" in a directory called
      "itsalltext". This approach should work for any external program that
      uses a reliably distinguishable file path.

      If other users have this problem, and if everyone agrees that this is
      a solution, maybe this can be added to the FAQ?

      Misha

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Jonathon Mah
      Hi Misha, ... You can make a shell script to wrap this command: $ cat ~/bin/mvim-hide #!/bin/sh mvim -c au VimLeave * maca hide: $* $ chmod a+x
      Message 2 of 5 , Oct 3, 2008
      • 0 Attachment
        Hi Misha,

        On 2008-10-03, at 18:26, Michael Dunn wrote:

        > However the plugin will not accept any arguments to this path, so
        > the advice in the help document:
        >
        > mvim -c "au VimLeave * maca hide:"
        >
        > can't be followed.


        You can make a shell script to wrap this command:

        $ cat > ~/bin/mvim-hide
        #!/bin/sh
        mvim -c "au VimLeave * maca hide:" $*
        <Ctrl-D>
        $ chmod a+x ~/bin/mvim-hide

        and then use the path to that as your executable. (Typed in Mail.app,
        untested.)



        Jonathon Mah
        me@...



        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_mac" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Michael Dunn
        Jonathon, ... Good idea, that s a much more general solution than mine. M --~--~---------~--~----~------------~-------~--~----~ You received this message from
        Message 3 of 5 , Oct 3, 2008
        • 0 Attachment
          Jonathon,

          2008/10/3 Jonathon Mah <me@...>:
          > You can make a shell script to wrap this command:

          Good idea, that's a much more general solution than mine.

          M

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_mac" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Steve Huff
          ... i had this same problem and requested a solution recently; there s a much simpler way. 1. open MacVim preferences and select the General pane 2. Select
          Message 4 of 5 , Oct 3, 2008
          • 0 Attachment
            On Oct 3, 2008, at 4:56 AM, Michael Dunn wrote:

            > If other users have this problem, and if everyone agrees that this is
            > a solution, maybe this can be added to the FAQ?

            i had this same problem and requested a solution recently; there's a
            much simpler way.

            1. open MacVim preferences and select the "General" pane
            2. Select "After last window closes: Hide MacVim"
            3. ...
            4. profit!

            unfortunately, this won't help you if you tend to have many MacVim
            windows open simultaneously, but i've found that it fits well with my
            workflow.

            -steve


            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_mac" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Brian McKee
            ... Doesn t work for me - haven t figured out why yet.... --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_mac
            Message 5 of 5 , Oct 3, 2008
            • 0 Attachment
              On Fri, Oct 3, 2008 at 5:23 AM, Jonathon Mah <me@...> wrote:
              > On 2008-10-03, at 18:26, Michael Dunn wrote:
              >> However the plugin will not accept any arguments to this path, so
              >> the advice in the help document:
              >> mvim -c "au VimLeave * maca hide:"
              >>
              >> can't be followed.
              > You can make a shell script to wrap this command:
              >
              > $ cat > ~/bin/mvim-hide
              > #!/bin/sh
              > mvim -c "au VimLeave * maca hide:" $*
              > <Ctrl-D>
              > $ chmod a+x ~/bin/mvim-hide
              >
              > and then use the path to that as your executable. (Typed in Mail.app,
              > untested.)

              Doesn't work for me - haven't figured out why yet....

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_mac" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            Your message has been successfully submitted and would be delivered to recipients shortly.