Tuesday, 24 April 2012

Best way to hack code

For the best part of 4 years now I've been doing the majority of my development on a virtual machine. This allows me to keep my development environment perfectly inline with production, same operating system, exact same package versions etc, and then easily hand that disk image around to other developers who might need to hack on it.

Over the years it seems others agreed. Along came vagrant to make this easier. Along came chef/puppet to make installing the packages easier. My point here is that a lot of people are now using VMs as their dev environment. Your desktop can be whatever the hell you want, since your code runs somewhere else. You can easily swap from one project to another without having to worry about that legacy project not working on your nice, up to date desktop.

I've also been using vim as my editor of choice for the past 13 years. I've dabbled with things like UltraEdit, Notepad++, TextMate, E-Editor, SublimeText 2 and I always palmed them off for whatever reason. I decided to check that style of developing out again and I've really come to like it.

TextMate (and in turn E-Editor since it supports all of TextMates plugins) and SublimeText have built quite a large community around them now and plenty of people are writing nice plugins so you can do all kinds of things right inside your text editor. With vim there are certain things I've been doing for years, that these newer editors can now do as well due to the work of these plugins. I'm talking things like git diff/status, compile check this selection of code or entire file. Run this selection through some sort of lint program etc.

However, the desktop editors can only do this if the machine you are using the editor on has the right stuff installed. Due to the VM dilemna mentioned above, the only place that can truly run any kind of proper compile checks or test runs and the likes, is the VM itself. Unfortunately none of the editors mentioned above have the functionality to run commands over SSH, all the plugins etc are just written to run whatever locally. This seems short sighted to me, as mentioned it seems a lot of people are going the VM route.

Cue X-Forwarding. It's a pain to install libgtk on a base VM that just runs ruby code, but I figured I'd try it out. This way I can run the editor directly on the VM and have the output on my desktop. All good in theory. Unfortunately SublimeText runs like an absolute dog over SSH for some reason. Time to start toying with other X based IDEs such as gVim? Or throw my mouse away and start writing more helpful vim macros?

No comments:

Post a comment