The situation is: I have one MacVim open for coding. Then I switch to iTerm to run git commit, which will open a new MacVim for editing the commit message per my setting. The problem is, when I finish writing the commit message and close the MacVim window, the previous iTerm window is not focused. The other MacVim window is focused instead.

Is there any way I can change this behaviour? I just want the previous window get focused when I close a window.

  • 1
    I don't believe so. It seems that focus is maintained in the application unless you quit it entirely. – user3463 Jul 13 '12 at 4:24
  • I've always hated this about OS X. Classic Mac OS did this right. – Spiff Jul 13 '12 at 6:21
  • 2
    couldn't you shell out from macvim to perform the commit? :!git commit, which would then start a new macvim for the commit message, which would disappear when you finished... returning you to your original macvim? Actually, it might even just open another window in your current macvim. Don't know for sure on that bit. – lornix Jul 14 '12 at 21:12
  • @lornix Thanks, that's a good workaround. But there are other cases when I have this focus issue. – lilydjwg Jul 15 '12 at 8:56
  • instead of running git commit try running eval git commit and see if it runs it as a seperate macvim process that when closed is not tied to the other macvim. – d4v3y0rk Sep 19 '12 at 15:16

OK, I think I have figured this one out. Here is a way to test it.

I tried this with TextMate and it worked.

when you launch macvim launch it from the binary executable. I launched textmate from

/Applications/TextMate.app/Contents/MacOS/TextMate &

you can create a simple launcher that does this and put it in /bin or somewhere is your path. then each time you launch the macvim it will be a new instance. and when you close one it will revert to the previous application instead of the other instance of that app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.