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

Re: Idea: raiseTerminal action

Expand Messages
  • Gregory Seidman
    Seems like overkill. How about !open -a Terminal --Greg ... --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_mac
    Message 1 of 6 , Feb 4, 2009
      Seems like overkill. How about !open -a Terminal

      --Greg

      On Wed, Feb 04, 2009 at 11:01:59PM +0100, Niklas Lindstr?m wrote:
      >
      > Hi!
      >
      > Personally I work like that very rarely (although with a switch like
      > this I'd consider practicing it a bit more). I wonder if a macaction
      > for Command-Tab might do?
      >
      > Say :maca switchApp:?
      >
      > Manual version:
      >
      > !osascript -e 'tell application "System Events"' -e 'keystroke tab
      > using command down' -e 'end tell'
      >
      > (Autocommand:ed with VimLeave, or VimLeavePre if the last vim closes MacVim.)
      >
      > (Hm.. This might be very useful for stuff like "It's All Text" as well..)
      >
      > Best regards,
      > Niklas
      >
      >
      > On Wed, Feb 4, 2009 at 10:15 PM, bj?rn <bjorn.winckler@...> wrote:
      > >
      > > Hi,
      > >
      > > Here's a general situation that I run into all the time: I'm in
      > > Terminal and type 'mvim' to open a file to make one small change and
      > > then close it again. When I close the window I need to manually
      > > switch back to Terminal with Cmd-Tab even though the Terminal window
      > > is layered right under the MacVim window I just closed (Mac OS X will
      > > raise another MacVim window even if it is layered below the Terminal
      > > window, which I guess is the correct behavior for most programs but in
      > > this instance it is a nuisance).
      > >
      > > I've been searching for a way to figure out which app the window under
      > > the topmost MacVim window belongs to and then switch to the app that
      > > owns that window when I close my MacVim window, but I cannot find any
      > > way of doing this. So, I came up with another (not very elegant)
      > > idea: add an action called "raiseTerminal:" and call that when the
      > > window closes by starting MacVim like this:
      > >
      > > mvim -f -c "au VimLeave * maca raiseTerminal:"
      > >
      > > (I am already doing this more or less, but I call "hide:" instead but
      > > it is kind of annoying if there are other MacVim windows open as they
      > > will be hidden. By the way, the above command (with "hide:") is what
      > > I set my EDITOR environment variable to so that MacVim pops up when I
      > > edit Git commit messages.)
      > >
      > > An obvious extension the above idea is to add a user default so that
      > > you may choose which app "raiseTerminal:" actually will raise (e.g.
      > > iTerm).
      > >
      > > Does anybody have any better ideas on how to deal with this problem?
      > > Would anybody find the above functionality useful (I would use it all
      > > the time with EDITOR).
      > >
      > > Bj?rn
      > >
      > > >
      > >
      >
      > >
      >

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Niklas Lindström
      Oh, certainly. If you mean !open -a as better than e.g. :maca raiseTerminal: + config option? I was more thinking of whether there are
      Message 2 of 6 , Feb 4, 2009
        Oh, certainly. If you mean "!open -a <weapon-of-choice>" as better
        than e.g. ":maca raiseTerminal:" + config option?

        I was more thinking of whether there are common cases of invoking
        MacVim for one-offs, where providing a generic method of switching
        back to the previous app would be useful (well, preferably the
        invoking app, but I don't know how to track that).

        (As admitted though, I don't really work like that myself today.)

        Best regards,
        Niklas


        On Wed, Feb 4, 2009 at 11:16 PM, Gregory Seidman
        <gsslist+vim@...> wrote:
        >
        > Seems like overkill. How about !open -a Terminal
        >
        > --Greg
        >
        > On Wed, Feb 04, 2009 at 11:01:59PM +0100, Niklas Lindstr?m wrote:
        >>
        >> Hi!
        >>
        >> Personally I work like that very rarely (although with a switch like
        >> this I'd consider practicing it a bit more). I wonder if a macaction
        >> for Command-Tab might do?
        >>
        >> Say :maca switchApp:?
        >>
        >> Manual version:
        >>
        >> !osascript -e 'tell application "System Events"' -e 'keystroke tab
        >> using command down' -e 'end tell'
        >>
        >> (Autocommand:ed with VimLeave, or VimLeavePre if the last vim closes MacVim.)
        >>
        >> (Hm.. This might be very useful for stuff like "It's All Text" as well..)
        >>
        >> Best regards,
        >> Niklas
        >>
        >>
        >> On Wed, Feb 4, 2009 at 10:15 PM, bj?rn <bjorn.winckler@...> wrote:
        >> >
        >> > Hi,
        >> >
        >> > Here's a general situation that I run into all the time: I'm in
        >> > Terminal and type 'mvim' to open a file to make one small change and
        >> > then close it again. When I close the window I need to manually
        >> > switch back to Terminal with Cmd-Tab even though the Terminal window
        >> > is layered right under the MacVim window I just closed (Mac OS X will
        >> > raise another MacVim window even if it is layered below the Terminal
        >> > window, which I guess is the correct behavior for most programs but in
        >> > this instance it is a nuisance).
        >> >
        >> > I've been searching for a way to figure out which app the window under
        >> > the topmost MacVim window belongs to and then switch to the app that
        >> > owns that window when I close my MacVim window, but I cannot find any
        >> > way of doing this. So, I came up with another (not very elegant)
        >> > idea: add an action called "raiseTerminal:" and call that when the
        >> > window closes by starting MacVim like this:
        >> >
        >> > mvim -f -c "au VimLeave * maca raiseTerminal:"
        >> >
        >> > (I am already doing this more or less, but I call "hide:" instead but
        >> > it is kind of annoying if there are other MacVim windows open as they
        >> > will be hidden. By the way, the above command (with "hide:") is what
        >> > I set my EDITOR environment variable to so that MacVim pops up when I
        >> > edit Git commit messages.)
        >> >
        >> > An obvious extension the above idea is to add a user default so that
        >> > you may choose which app "raiseTerminal:" actually will raise (e.g.
        >> > iTerm).
        >> >
        >> > Does anybody have any better ideas on how to deal with this problem?
        >> > Would anybody find the above functionality useful (I would use it all
        >> > the time with EDITOR).
        >> >
        >> > Bj?rn
        >> >
        >> > >
        >> >
        >>
        >> >
        >>
        >
        > >
        >

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_mac" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Tobia Conforto
        ... This is a nice idea. The window under the topmost MacVim windows clearly belongs to the second most recently used app, which is the first choice doing a
        Message 3 of 6 , Feb 6, 2009
          Niklas Lindström wrote:
          > I wonder if a macaction for Command-Tab might do?

          This is a nice idea.

          The window under the topmost MacVim windows clearly belongs to the
          second most recently used app, which is the first choice doing a
          single Cmd-Tab.

          -Tobia
          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_mac" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • björn
          ... Yes, Niklas idea is certainly better than my switch to terminal idea. Of course, Greg is right when he said its overkill to implement this as an action
          Message 4 of 6 , Feb 7, 2009
            2009/2/6 Tobia Conforto <tobia.conforto@...>:
            >
            > Niklas Lindström wrote:
            >> I wonder if a macaction for Command-Tab might do?
            >
            > This is a nice idea.
            >
            > The window under the topmost MacVim windows clearly belongs to the
            > second most recently used app, which is the first choice doing a
            > single Cmd-Tab.

            Yes, Niklas' idea is certainly better than my "switch to terminal"
            idea. Of course, Greg is right when he said its overkill to implement
            this as an action in MacVim when it can already be done with the
            "open" command (I didn't think of that).

            As long as there is no advantage to implementing this functionality in
            MacVim (since it can already be achieved with applescript etc) I will
            just let it rest.

            Thanks,
            Björn

            --~--~---------~--~----~------------~-------~--~----~
            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.