Ruby
Article

What Editor Do Rubyists Use?

By Abder-Rahman Ali

editors

Well, you’ve decided to learn Ruby, have you? That’s great! Ruby is a wonderful language that aims to make programmers happy. Go for it! As you enter the world of Ruby you realize, “I need an editor”. OK, Google, find me the best Ruby editor.

Holy smoke! There are a ton of editors, each with a community that swears by its features. “Use vim!” “Use Emacs!” “Use TextMate!” “Use Sublime Text!”. You recoil in fear….what if you make the wrong choice???

This short story, which likely applied to many Rubyists, inspired me to interview established Rubyists about their best Ruby editor. If nothing else, this will show which editors are used by more Rubyists, with some data as to why. My hope is that it will serve as a guide for newcomers to Ruby, or possibly even those already working with Ruby, on which editors are popular.

I spoke to 100 Rubyists. The interviews brought up the following editors (given in order of preference):

  1. Vim
  2. Sublime Text
  3. Emacs
  4. Atom
  5. TextMate
  6. Sakura
  7. Pico

Vim was, by far, the most preferred editor, being utilized by 50% of the interviewees. The charts below tell the tale:

columnchart

piechart

I spoke to two of the most well-known Rubyists: Yukihiro Matusmoto (Matz) and David Heinemeier Hansson (DHH). If you don’t know, Matz is the creator of Ruby as a language, and DHH is responsble for Ruby on Rails. Matz prefers Emacs, while DHH uses the original version of TextMate. I find it very interesting that two pillars of Ruby don’t use the most popular editor, surely something to consider when choosing your toolset.

Regardless, Vim wins the Most Used Ruby Editor award for my sample set. Vim was written by Bram Moolenaar, and first released to the public in 1991. There’s no end to the articles about Vim on the web, including two very good ones here on SitePoint. Islam Wazery penned Getting Started with Vim and Effective Rails Development with Vim, both worth reading if you are choosing the beaten path.

But, what is it that makes Vim so special? Well, the answer is “many, many things”. I will pick a couple of items from an article called Great Vim Features that consists of contributions from many Vim users to try and drive the point home.

Stephan Houban states that one of the features of Vim he loves is the macro feature. At first glance, this feature may not seem so special. q[letter] starts recording a macro, a second q terminates it. The macro is invoked my typing @[letter].

But, that’s just when the fun starts. Let’s say I want to create a macro that does the following: Go down one line and replace the first and the second word. Using standard Vim commands, this can be expressed as: j^dwwhp

Recording this sequence into a macro called @a is done as mentioned previously. Now, you can repeat the macro for all the lines in the file, if you like. Not bad!

Stephan Thorn comes in and says, “This is nice, but the idiom can be improved immensely using :g.”

For example, you’ve got a macro for changing the second word on a line to “foo” qb^wcwfoo<esc>q (man, that looks weird to type). Now, visually select a block you want to perform the macro. Don’t yank the selection, though, instead press :, which will place you into command mode for the selected block (the command line looks like :'<,'>, marking the start and end of the visual block). Then, append g/^/normal @b, so the command line looks like:

:'<,'>g/^/normal @b

(Note: This presumes the macro you recorded was saved with the letter ‘b’.)

This will execute the macro for each line in the visual block. Complex to explain, but it’s surprisingly quick once you’re familiar with visual mode and :g/.

Another contributor in that article compares some features with Emacs:

“IMHO, the single most useful feature of VI which Emacs does not have (AFAIK) is the . (dot) command, which repeats the previous operation. (i.e.: previous insert, replace word, delete word, …). It makes you appreciate why VI is a modal editor.”

(It’s worth noting that Emacs users have responded to this claim, which is another reason to read it.)

Finally, I would like to highlight another comment about someone’s preferred features in Vim:

I definitely appreciate the following features of vim:

  • unlimited undo
  • editing the history of ex commands (issue some ex commands, press : and use the arrow keys)
  • editing the history of search commands incremental search
  • persistent marks

While Vim has a commanding lead in numbers, that is but one consideration. Do you have an opinion? Love Vim? Use Sublime Text? What is your best Ruby editor?

Comments
pducks32

I love Atom, its clean, beautiful and as Github puts it "incredibly hackable." I'm a big design nerd (hence my Ruby and Apple usage) so Atom feels very nice.

poisonborz

Don't know too much of Ruby, but - as it's coming from the most prominent IDE developer, JetBrains - it's at least odd not to see RubyMine here

abderhasan

Thanks @poisonborz for your comment. For this post, the concentration was on the editors and not the IDEs. Maybe in a future article, the most used IDEs in the Ruby community will be handled. I hope this makes sense. Please don't hesitate to post again for any question.

cpradio

So because RubyMine does more than editing, it gets excluded? That seems a bit short-sighted to me. I happen to use IntelliJ for most of my "editing/development" when I need to work on anything outside of the .NET framework.

I may not touch most of what that application offers, but it serves my editing twitch very well and gives me the option of utilizing the other tasks it is able to handle should the project require it.

Everything I see necessary for what most deem "to be a good ruby programmer" is: An editor, a way to write tests, a way to execute tests, and version control. Anything that implements those items and maybe more, seems like a fair contender to me...

I actually almost bought RubyMine, but I already had a phpStorm license and I wanted to get into Python a bit too, so upgrading to IntelliJ was by far the best decision I've made. I'd highly recommend it as an editor (or the cheaper RubyMine product if you don't need to support multiple languages).

So I'm not sure on the distinction you are trying to make between IDE and Editor, to me there is a great overlap between the two.

I've also been spending a lot of time in Cloud9 (again, this may fall under your IDE side, but it is free to use and its editor has been really nice to work with -- gives me quick ways to run/write tests, etc.)

poisonborz

But of course, silly me -.-' I wonder if such article - for most languages, not just Ruby - could be more than just a simple comparison of known players (NetBeans/Eclipse-Aptana/Jetbrains/Komodo) - I guess not too many exotic solutions exists outside of that pack.

abderhasan

Yes, I also wonder that. If that article moved through, and I was able to interview Rubyists (at least for this section) out there, I think it will reveal this issue more clearly.

abderhasan

Thanks @cpradio for your comment and nice information.Yes, an IDE can surely serve as a text editor, but, as you know, it can also do much more, like compiling code, running code, ...etc.

There are situations where you just simply need only a text editor, and there are others where you want to go beyond that, to using an IDE.

Most of whom I interviewed, including Yukihiro Matusmoto (Matz) and David Heinemeier Hansson (DHH) replied with one or more of the editors listed above, provided that I didn't ask them to choose from certain editors, rather, the question was an open question. Even the small portion that replied with RubyMine for instance, when asked that the goal of the interview is about a text editor and not an IDE, the next reply sent from them was a text editor of their choice.

So, it appeared to me that the community seems to be aware of this distinction between a text editor and an IDE.

Does that make sense?

cpradio

It makes more sense, yes. Thanks for the clarification.

abderhasan

You are very welcome! My pleasure

anandu

Where is RubyMine by Jetbrains?

abderhasan

Thanks for your comment. If you see the above comments, the concentration in this article was on the text editors and not the IDEs. Maybe in a future article the IDEs will be handled.

Please don't hesitate to comment again should you have any questions.

kenoli

I use Coda as if it were an editor, though I guess you could call it a "light" IDE. It does create "sites" and organize files into sites, preview scripted languages (no compiling) and has an ftp upload built in.

Was it simply not mentioned, i.e. not popular with Ruby programmers, or was it ruled out as an IDE? I know it has a decent following and is commonly compared to Sublime Text in arguments among Coda users over which editor is best.

--Kenoli

abderhasan

Thanks Kenoli for your nice comment. Regarding Coda, for all whom I interviewed for the Ruby editors, no one really mentioned Coda. It just seems not to be familiar amongst Rubyists.

s_byrne2254

I understand the reasoning behind your clarification but I think that leaving it out even though many people mentioned that it was their text editor of choice was a mistake. Sure, RubyMine is an IDE but that just means that the text editor is built in to the IDE. Excluding it from the list after getting it as a response from several people on Twitter and several people commenting on the article seems like a mistake to me. An IDE obviously must include a text editing component, and I actually clarified to you that I use RubyMine as only a text editor (without the built in additional functionality) and no other text editor, so to exclude that feedback from a list of Ruby editors because you don't believe it fits your definition of what an editor is just seems strange to me. It's like asking people which search engine they use and when they respond Google saying "no, Google doesnt count as a search engine because you can also manage email, spreadsheets, and video chat using Google."

abderhasan

Thanks for your comment. Yes, maybe some debate can happen as what would be considered a text editor. For that, I tried to clarify that in my other post where I tried to differentiate between a text editor and an IDE. You can find it here: http://www.sitepoint.com/ides-rubyists-use/
Please let me know your thoughts. Thanks.

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in Ruby, once a week, for free.