Ruby Editors / IDEs

September 24, 2006

I’ve been working with Ruby (mostly Ruby on Rails) for over a year now, both at work and at home, but I still haven’t settled on a Ruby IDE or editor. Most of my development is done in Linux, but lately I’ve started working in Mac OSX, as I have recently adopted an old PowerBook G4 at work, which then got me hooked and prompted me to go out and buy a Macbook for home as well… (more about my initial experience with OSX later).

The list below is not exhaustive, it merely contains the alternatives that I have seriously considered. A few additional editors and IDEs are included in the articles listed in the resources section at the bottom.

Of course, I immediately tried out TextMate on the Mac, and it is indeed a very nice editor. In addition to snippets and rudimentary code completion, it has some nice Rails shortcuts for switching between views and controllers, etc. It also supports a large list of languages, so if your primary development environment is OSX, you should be able to use it for most of your projects. Last not least, TextMate has a very nice and hip UI. However, during the course of the 30-day trial I haven’t really invested enough in learning about all the productivity enhancing features. Now that the trial is over, I am trying to determine whether I should buy it. 39 Euro (about $50) is certainly reasonable for a useful tool like this, but at the same time there are some solid open source alternatives that I want to check out first. I would also prefer a multi-platform editor that works on both Linux and OSX, rather than having to invest in learning two different editors. So I might come back to TextMate, but for now I’ll evaluate some of the alternatives.

RadRails is an Eclipse based Ruby on Rails IDE that combines the RDT Ruby plugin with some Rails specific features. I have mostly used earlier versions, which were still a little rough around the edges, but I’ve heard that RadRails has come a long way since then. Since my primary programming language is still Java and I use Eclipse for this, RadRails is a natural choice for working with Ruby on Rails. It comes both as a standalone version and as an Eclipse plugin, so you can work on Java and Rails projects in the same IDE.

Of course, as it is based on Eclipse, it does sometimes feel a bit heavyweight. Especially at home, where I rarely work with Java these days, a more lightweight solution might be preferable - particularly as RadRails still doesn’t come close to the kind of functionality you get in any decent Java IDE (including Eclipse) these days in terms of code completion, refactoring, etc. But according to this blog post, it seems to be possible to debug Rails applications from within RadRais, which would be a nice feature.

jEdit is one of my favorite cross platform editors. Even though it is Java based, it still feels pretty lightweight. Out of the box it supports syntax highlighting for many languages, but it really shines for Ruby development when you add the Ruby Editor Plugin. As of version 0.8 of the plugin, this is as simple as installing it using jEdit’s built-in Plugin Manager. With this plugin, jEdit easily has the best auto-completion support I’ve seen in any Ruby IDE (again, I have not tested recent versions of RadRails). It actually parses your code to infer the classes that correspond to your variables, and pops up the relevant rdoc at appropriate times, such as when typing a period after a variable name. It also adds some configurable shortcuts to pop up searchable ruby docs or a view of the file structure.

If you want to get the same level of support that TextMate has in form of its Snippets functionality, you may also want to install the SuperAbbrevs plugin. If you’re running the stable jEdit version (currently 4.2), you should be able to install this using the Plugin Manager as well. If you’re on 4.3, you’ll need to manually download and manually install the SuperAbbrevs Beta 2 for jEdit 4.3. You’ll probably also want to install these jEdit Snippets for Ruby on Rails, which simulate all the TextMate snippets and more. There’s also a good tutorial on setting up the SuperAbbrevs plugin.

A good collection of resources to set up jEdit as a TextMate equivalent for Ruby on Rails development can be found here.

For now, I think I will stick with jEdit. It takes a bit of effort to configure it to work the way you want, but it is extremely versatile. It is also available on pretty much any platform, and investing in learning how to use jEdit as a general purpose editor should well be worth the effort.

vi

I am not much of a vi / vim person, but vi certainly has one thing going for it: It’s installed by default on pretty much any Unix machine, and it’s available for pretty much any other platform. It is also extremely powerful, but this comes with a steep learning curve that I have so far always shied away from. If you’re already a vi expert, this may be a natural choice for Ruby / Rails development as well. The Rails Wiki contains a page that describes various alternative setups for using vim with Rails, some of which sound quite powerful.