gvim over ssh

I use vi for development.

I keenly remember one of Dr. Eggen‘s early lectures to us.

“There are other editors out there, but if you learn to use vi, you will have a powerful editor on every unix server you ever use…” (or something like)

It took me the about halfway through the compsci intro class to get used to command mode vs. input mode, but since then I have never looked back. Using keyboard commands to perform editing has become second nature to me, and I find myself constantly typing ESC then yy on windows text editors… Then I promptly install vim for Windows. Making Dr. Eggen’s point even more valuable.

However, I have gotten used to gvim. Its really the best of both worlds. You can use mouse based cut and past, but all of the command mode goodness still works. I must admit that I have never memorized the search and replace syntax and the fact that it is a dropdown menu on gvim really helps.

More and more I have been programming in the cloud. Which means I am frequently (for hours each day) using vim over ssh. But I miss gvim and the helpful menu items. I have been looking for a way to easily use gvim on a remote host for some time. Sharing an X session over the internet has always felt a like overkill to me. No cloud server should have X installed in any case.

The answer sshfs. Here is a link to a tutorial to using sshfs.

Basically the idea is that you have scp mirror a whole directory content, in real time, to a local directory. Because it is a local directory, gvim works fine. Of course, it takes an extra second for files to load… but now I can use gvim to my hearts content. It also means that I can edit ten different files at once, a pretty important feature if you are doing serious development work. This lets me code for the cloud in the cloud, which is lovely.

[Update Dec 19 2010] Happily this works with Mac OSX to… but you need to be sure to download the right version of gvim from here: http://code.google.com/p/macvim/ the one that comes up first when you search… sucks…