28 November 2010

Choosing a text editor for Rails development

A few years ago I wrote a series of posts called the emacs newbie guide to rails about getting emacs up and running on OS X, primarily for Ruby on Rails development. The posts turned out to be quite popular, as there were no other similar tutorials around at the time. As with all things in software, things change, so I have reproduced the posts here with a few updates and a few more things I have learned along the way.

Textmate

Anyone who has been around the Rails scene for a while know a lot of Rails developers use OS X, and Textmate seems to be the editor of choice on that platform. For me, the problem is that Textmate is Mac only, and I often have to edit files on Windows, Linux and in terminal sessions. Learning a new editor well is quite a lot of work, and if you are going take the time to learn one, it better be available on any OS you need to edit files on. For that reason I quickly gave up on Textmate, but not without falling in love with its file browsing pane.

Enter Emacs

If you want to learn an editor that is available everywhere, then your choices boil down to Vim or Emacs. I decided on Emacs. Vim is probably just as good, but I had to choose something and Emacs won.

The Goals

Emacs out of the box is nowhere near as user friendly as Textmate, and a file browsing pane is non-existent. So I set about learning enough about Emacs to get an editor that:

  • Provides a file browser pane like in Textmate
  • Ruby (and other languages) syntax highlighting
  • Automatic code indenting and automatic closing braces, quotes, if statements would be nice
  • Compile/Run code inside the editor
  • Do all of this on Windows, OS X and inside a decent terminal

Other things that would be nice nice to have:

  • Rails code snippets like in Textmate
  • Spell check as you type
  • Customisable color schemes to suit tired eyes

If you follow all the parts of this tutorial, you will quickly Emacs setup to meet the goals about and a little bit more.

blog comments powered by Disqus