Focus previous window when I close one instead of one of the same application in Mac OS X?

6

1

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.

lilydjwg

Posted 2012-07-13T02:10:59.797

Reputation: 817

1I don't believe so. It seems that focus is maintained in the application unless you quit it entirely. – None – 2012-07-13T04:24:08.827

I've always hated this about OS X. Classic Mac OS did this right. – Spiff – 2012-07-13T06:21:06.060

2couldn'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 – 2012-07-14T21:12:10.630

@lornix Thanks, that's a good workaround. But there are other cases when I have this focus issue. – lilydjwg – 2012-07-15T08:56:58.333

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 – 2012-09-19T15:16:29.280

Answers

1

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.

d4v3y0rk

Posted 2012-07-13T02:10:59.797

Reputation: 1 187