3
1
I'm running Mavericks and I recently started playing around with sshfs
to try to boost my productivity by using MacVim (I've been using in-terminal vim for a few years now). I really like MacVim.
I only have one issue so far. I've configured MacVim to hide after closing, which is perfect. Suppose I want to edit main.cpp
, I simply launch mvim main.cpp
from the cmd line and MacVim opens up. When I'm done with main.cpp
, I close MacVim (via :wq
) and my terminal regains focus right away. Perfect.
The only issue I face is that if, while editing main.cpp
, I focus to another window, say, Google Chrome to look something up, then continue editing main.cpp
. After closing main.cpp
, Google Chrome would regain focus rather than my terminal.
Is there any way to force MacVim to remember from where it was launched and always regain focus to that place? I will always launch MacVim from a terminal.
MacVim's Vim can be run in a terminal, which would allow you to use sshfs there. All you need to do is find
mvim
in your path, and then make a symlink to the same target there but call itvim
. That will override the Apple-provided Vim, giving you all of MacVim's features in the terminal. – echristopherson – 2014-08-29T18:25:13.043Agreed, although one of the things I like most about MacVim GUI is the fact that I do not lose a terminal window to Vim. For example, up until I started using MacVim, I would have side-by-side terminal windows, one where vim would be open editing files, and another where I would run bash commands. Using GUI vim, I do not have to sacrifice a terminal window, it just opens. I would prefer to keep that functionality. – Amit – 2014-08-29T18:35:37.543
1Why do you want MacVim to quit on
:q
? Why don't you simply keep it running? – romainl – 2014-08-30T22:32:31.427@romainl: If you leave it running in the background, then I'll have to cmd+tab into Terminal since it won't focus on it automatically. – Amit – 2014-09-01T02:54:53.480
I've +1'd your comment since it was a combination of your comment and @Fdinoff's answer that helped me fix it. Thanks! – Amit – 2014-09-01T02:56:40.817