Choosing my editor for Ruby on Rails

When I learnt C, in 1995, I used a DOS editor by Borland. Since graphical environments became popular and more used, programming editors were also evolving. Nowadays we have two different kind of editors: text editors and IDEs. The first ones are lightweight, while the second kind focus on providing as many tools as possible to unify everything we would need.

In order to develop for the major operating systems, brands usually provide an official IDE. For instance, if you want to develop iOS or macOS applications you should use Xcode from Apple. If you want to develop for Android you have Android Studio (based on Eclipse). For Windows applications you have Visual Studio.

Outside official environments there is a wide range of options. Text editors can be used for multiple languages, while IDEs tend to be more specialised. Let’s take a look at the options I have been trying for Ruby on Rails, my framework of choice to develop web applications.

Sublime Text

Sublime Text logoThis is the editor I used the most during some years. It’s not free, but you can try it out as long as you want (a message will pop up often to remember you to buy a license).

There are very good things about this editor. It has a very good multi-cursor implementation that lets you select similar occurrences very easily to make fast changes. It also has an excellent “Goto anything” feature that lets you type whatever displaying matching files in your project.

It’s cross platform and has a good plugin system, which made it a no-brainer when choosing a multi-language editor.

Since version 3 it became abandoned by its main programmer. I’m writing this article on November 2015, and the latest (beta) version of this editor was released on March 2015. Its development has been very slow but it was not a real problem because it had no good competitors. This is not true anymore, so I opted to stop using it and search for alternatives.

Atom

Atom logoAtom is an open source editor created by GitHub. It’s based on Chrome technologies and it’s very customisable. As they say: a hackable text editor. This seems to be the natural successor to Sublime Text, so I used it for an entire project and I felt very comfortable. Everything seemed familiar and easy-going to me.

Being free is a major boost for its success, and coming from GitHub gives a warm feeling of “being at home”.

What I like

  • Very easy to install plugins.
  • There is a huge community helping to implement new features. There are plugins for almost everything. For instance, rails-transporter, that though CTRL-R and then a C or a V you can navigate between the controller and the view.
  • Searching is easy and direct. It uses a dedicated tab for this and updates the results while you change the code.
  • In macOS you can use the tab key to shift lines of code to the right without affecting snippet generators.
  • It strips white-spaces and adds a blank line at the end of the file when saving.
  • Very good support for linters, marking suggestions in place.
  • It has a very good dark theme with a comfortable design.

What I dislike

  • It does not recognise Rails files, opening them always as Ruby files. I have put a command in the configuration file so it always opens Ruby files as Rails files, but I think this is not ideal.
  • Fuzzy Finder does not work properly for me. With experimental options turned on it saves the latest file I searched, but if I change the search a little it will not be recognised anymore and will suggest strange results. For instance, if I have the app/models/application.rb model file and I search for app it suggests config/application.rb. If I choose the model it will be suggested correctly next time I search for app, but if I search for ap or appl it will suggest config/application.rb again.
  • It’s based on Chrome and developed using Javascript, and that means more resources (memory and CPU). It will always be a little slower than a native application.
  • It suggests too many things while typing. If you disable this feature you will have to use CTRL+space, but instead of autocompleting the best result it will display a list. This is a personal preference, but I prefer to cycle among suggestions after each keypress.
  • After opening a file with the option “Use Preview Tabs” enabled (in the tabspackage), the focus will be on the file browser. This is very bad for me because I used this mode on Sublime Text a lot to copy & paste between two files, and paste will definitely not work while the focus is on the file browser.
  • It’s not a pure editor, it’s noticeable that Chrome is behind. When the focus is on the file browser, pressing the space key makes a scroll, as in Chrome. This is not important at all, but it gives me a feel of being working in the browser.

TextMate 2

TextMate logo

The most similar editor to Atom is TextMate. It was a pretty solid option back in the beginning of Ruby on Rails. It was used by Ryan Bates in RailsCasts, so many people followed Ryan’s choice. It is also the choice of David Heinemeier Hansson, who helped Macromates to develop some features in its early stages.

It has always been a paid piece of software, but since version 2 it has been open sourced and therefore free. It’s a beta product though, but overall it works very well. It’s for macOS only.

What I like

  • Simple. It focuses only on text editing with some utilities. So everything else can be done using the terminal.
  • It’s an macOS native application and follows macOS standards, about both the interface and the way it works with files and keystrokes.
  • About the search feature I like it when it marks with an icon in the gutter the lines containing matches.
  • Fuzzy Search works very well, remembering your choices.
  • File type detection.
  • It has many shortcuts to create tags (snippets) and commands.
  • It saves the file state (block collapses, selection, caret position…), using a file system feature from macOS (extended attributes).
  • Template syntax highlight differentiates very well Ruby tags, being possible to quickly see where is the Ruby code in an ERB file.
  • It has a simple and useful Git client.
  • Good snippets support. I can also create Ruby tags in ERB files by pressing CTRL+Shift+<

What I dislike

  • I can’t use the tab key to shift the code to the right, being forced to use CMD+](although this is an macOS standard that I’m getting used to).
  • Some bugs show up often making some things not working at all. For instance, when creating a new file it’s assigned a default name directly. Also, when opening the bundles editor an empty list is displayed, so by scrolling down I can see the actual list but I cannot select any item until I use the keyboard somehow.
  • When selecting a Ruby symbol it also selects the colon.
  • About the search feature I don’t like it being a separate window. After clicking on a result it closes, so it must be opened again to see the rest of results.
  • For basic operations such as removing trailing spaces or adding a blank line at the end of the file after saving, we have to install third party bundles which are old and can be abandoned some day.
  • Scroll is not completely smooth.

RubyMine
RubyMine logo

I used PhpStorm from Jetbrains when working with Symfony2, and I was happy. Maybe because Symfony2 uses namespaces and can be a pain to remember all paths, the help of an IDE is very appreciated. It also uses annotations to define routes and variable types, and this is alleviated by PhpStorm.

Ruby on Rails doesn’t need an IDE because it follows conventions instead of being explicit as other frameworks. But I thought it would be a good candidate because the way it shows the files structure (it can be configured to group models together with fixtures, and other useful things), as well as the way it provides all the tools you would ever need to not leave the IDE at any moment. So I had to check it out.

This one is the only paid option of this comparison, although it’s not expensive at all looking at the tools it includes (I’m thinking on that database manager it has thanks to Java and its connectors).

What I like

  • It unifies all ever needed tools, such as the debugger, the terminal, the database client, and so on.
  • It can organise files grouping by controllers, models, helpers, layouts, views, and so on.
  • You can access any class/object/method declaration with just a click. This is great to inspect gems and even Rails internals.
  • You can go directly to the controller or the view using the gutter icons.
  • It includes a very good Git client. The diff tool is great.
  • It has a good database manager. It can even display a diagram!
  • Very configurable, it has lots of options.

What I dislike

  • The “go to file” feature (Shift+CMD+o), it doesn’t find templates properly for me. For instance, in order to find my Sample controller index template, I type “samples index” and it doesn’t find anything, but typing “index” I can definitely see it in the list. TextMate and Atom can find it that way. Vim with CtrlP does it well too, but it doesn’t support spaces. Update: Thanks to Erik Hanson that commented that I should have used a slash to separate the directory from the template file.
  • It uses too many resources. After opening it, it takes about 500 MB, and after some minutes it surpasses the GB. I think this is a side effect of being developed in Java.
  • It has too many features, I feel anxious.
  • It doesn’t respond to some macOS standard keystrokes, such as going to the end of the file. They must be edited. There are also some cases such as when navigating through the results in the “Go to class” window, where it says that you must use CTRL+cursor, interferring with Exposé (if enabled).
  • The debugger, even being very complete and similar to an IDE for a compiled language, it’s rather complex. I prefer the simplicity of writing just “debugger” between some lines instead of creating a breakpoint and restart the server in debug mode. One thing I dislike about this is: I put a breakpoint and I evaluate a variable containing an array of objects. It returns a lot of things and I cannot see my objects list anywhere.

Vim

Vim logo

Vim is the editor I use to edit configuration files in servers. It’s installed everywhere by default, being a very powerful editing tool. But would it work for development? Many developers around the world using it is the response, so I had to try it by myself and feel the text-only power.

What I like

  • It uses very low resources.
  • It does almost everything thanks to its bundles. It has bundle managers that make the installation process very easy (such as “Vundle”).
  • Being text-only it can be used directly in a server through SSH.
  • It’s very comfortable to navigate through the text using only the “hjkl” keys. You can even exit the insert mode using the “jk” combination if you configure it.

What I dislike

  • Being aware of the modes.
  • I have to use MacVim to use the macOS keystrokes I’m used to. And this leads me to:
    • MacVim resizes and moves itself when I open the first tab.
    • MacVim does not remember the project I was working on, I have to open it again through the File menu.
  • It obliges me to use strange keys, such as the <leader> key, that is normally \(but it’s usually re-mapped to the Caps Lock, and I don’t like to lose that key even if I don’t use it normally).
  • The “extend selection” from TextMate (or the “multiple selection” by word from Sublime Text) does not work for me, even installing the corresponding bundle and following instructions.

Conclusion

As you see, I cannot find the perfect editor, it simply doesn’t exist (yet). So the only way to choose one is accepting the things I don’t like and keeping an eye on the rest.

Did you like it? Please share it:

Get my ebook for free

10 ideas that helped me become a better developer (and may help you too)

Subscribe to my mailing list and get my ebook on 10 ideas that helped me become a better developer.

About Me

David Morales

David Morales

I'm David Morales, a computer engineer from Barcelona, working on projects using Ruby on Rails and training on web technologies.

Learn More