I spent many hours today trying to find a good editor on Ubuntu Linux for working with Ruby on Rails.
Emacs, gedit, and other editors were not working well for me. I was having problem with indentation and syntax highlighting with .rhtml files so I began investigating other editors for Ruby on Rails that would run on Ubuntu Dapper Drake.
TextMate is an editor that is recommended by the Ruby on Rails team. I went to the TextMate web site and found out that TextMate is only for Mac OS X. It looks like a nice editor, but I was a bit turned off by the attitude of the web site:
"Created by a closet UNIX geek who was lured to the Mac platform by its ease of use and elegance, TextMate has been referred to as the culmination of Emacs and OS X and has resulted in countless requests for both a Windows and Linux port, but TextMate remains exclusive for the Mac, and that is how we like it!"
Exclusive, huh? Not interested...
I've been using Emacs for a while and have gotten used to doing most things with keyboard shortcuts. If I could find a way to make every program move to the next line when I press C-n, and move to the previous line when I press C-p I would be happy. (edit: I found a way to do this in GNOME on GNU/Linux but it interfered with some of my other keyboard shortcuts so I turned it off.)
Emacs was not indenting the .rhtml files correctly. I discovered that there is a Ruby on Rails mode for Emacs, but I didn't want to spend my whole day figuring out how to configure it, so I did a little more research.
There is some more information about Ruby on Rails and Emacs here. I would like to try using Emacs for Ruby on Rails, but I didn't have time to configure it today.
My next stop was RadRails, which seems to be a version of Eclipse that has Ruby on Rails plugins. It can also be installed as an Eclipse plugin.
I tried installing RadRails as an Eclipse plugin. I got errors when importing a Rails project.
I then tried downloading the full RadRails package. I got the same errors when I tried to import a Rails project.
RadRails looks good, but it was too much to deal with. I'm going to try it again when I have more time, but I was looking for a quick solution.
I used to use jEdit on Windows XP and liked it a lot. I managed to get jEdit running on Ubuntu after a little trial and error. I had also been through these steps when trying to get Eclipse and RadRails running.
I went through all the jEdit preferences and set them to my liking. I enabled some of the plugins, including the Ruby plugin for jEdit.
I also installed the jEdit emacs emulation package which gives jEdit some of the emacs keybindings.
So far, jEdit has been the best Ruby on Rails editor for me.
In my research I also came across Cream. Cream is apparently a collection of scripts that turn Gvim into an easy-to-use text editor. All of the features of vim are there, but in its default settings it is as easy to use a gedit or Windows Notepad. If you want more vim power, just set the preferences to "expert mode" and press ESC.
I only used Cream briefly with various Ruby on Rails files, but it seemed to handle syntax highlighting well. UPDATE: Also see the newer post about using Cream and vim with Ruby on Rails. This is an easy way to get some of the nice features of TextMate on Linux (like Rails code abbreviations).
UPDATE: Check out Alex Young's post on Vim for Textmate fans.
Another editor that I used is SciTE. I used SciTE on Windows and really liked it. It didn't seem to handle syntax highlighting for .rhtml files well. Does anyone know a fix for this? In any case, it doesn't have emacs keybindings that I know of, so I am sticking with jEdit for now.
I had planned to spend the entire day learning more Ruby on Rails. I ended up spending most of today experimenting with different editors and IDEs. I hope this page can help people find a quick solution to working with Ruby on Rails on Ubuntu.
Please leave a comment if you have any tips to add.