Github Twitter 2 Linkedin Stackoverflow Rss

Switching to Sublime Text 2

Updated – 07/16/2012

Please see my updated post for current instructions on getting Sublime Text 2 up and running on your machine.

Updated – 01/12/2012

I recently switched over to Sublime Text 2 for my primary development editor. I was waiting to see what TextMate 2 would be like, needless to say I didn't see much an improvement. Sublime Text 2 has got some nifty features like multiple columns, rows, or even grid views. After a few hours of having 2 files open side by side I was hooked. Below are the things I had to do to get it customized enough for me to use every day. As I continue to customize and setup Sublime Text 2 I'll be updating this post.

Command line Tool

To be able to open a file or folder from the command line from anywhere create a symlink to the subl command line tool.
ln -s "/Applications/Sublime Text" /usr/bin/subl


Edit Sublime Text's ruby settings file:
$ subl ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Ruby/Ruby.sublime-build

It should look like this:
  "cmd": ["ruby", "$file"],
  "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
  "selector": "source.ruby"

Change it to this (replacing nickd with your username) in order to use the rvm-auto-ruby binary:
  "cmd": ["/Users/nickd/.rvm/bin/rvm-auto-ruby", "$file"],
  "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
  "selector": "source.ruby"

Spacing and tabs

You can set Sublime Text 2 to use spaces instead of tabs and adjust the indentation, however it seems to only change it for the current file your on, to make it global edit the User Base File settings file. Update – As Kevin Yank & Dimitar Dimitrov point out in the comments, it is best to put any custom user settings in the User packages. This way updates won't overwrite them.
$ subl ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/Base\ File.sublime-settings
Add the following settings to the hash of options. You can take a peek at all the other package settings and put any customizations you want to retain here.
  // The number of spaces a tab is considered equal to
  "tab_size": 2,

  // Set to true to insert spaces when tab is pressed
  "translate_tabs_to_spaces": true,
To open all packages to see what's in them:
$ subl ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/

RSpec & Test::Unit

I found this great plugin for running both RSpec and Test::Unit tests from within Sublime Text 2, It allows you to run all the tests in an individual file and also supports focused tests, however focused tests don't seem to work for me. To get this installed:
$ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/
$ git clone

Sublime Package Control

Update – I'd like to thank Dimitar Dimitrov & Pablo Barrios for pointing out Will Bond's Package Control. Sublime Package Control is a great addition to Sublime's ecosystem. There are ton of useful packages and themes that you can add just by selecting them. Just follow the simple installation instructions and you'll be good to go.
Press cmd + shift + p and type "Package Control" to find all the options for this add on. You can also get to it under the Preferences Menu.


Sublime Text 2 supports TextMate bundles, to get CoffeeScript syntax highlighting just install the bundle through the package control.

Haml & Sass

To get Haml & Sass support clone this repository and copy the Ruby Haml and SASS folders into the Packages folder.
$ git clone
$ open ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/

Related Links


Kevin Yank
01/06/2012 06:47am

Excellent advice! One thing, though: you shouldn’t modify the Base File.sublime-settings file in the Default directory, as it will be overwritten when Sublime Text 2 is updated. Effectively, that file should always contain the “Factory Defaults” for the editor. Instead, you should override whatever settings you like in your own User settings file. See the Sublime Text 2 docs for details.

Dimitar Dimitrov
01/06/2012 07:43am

I've been using Sublime Text 2 for quite some time now and I'm very happy with it. This editor makes me happy and I feel very productive with it, which is important for me.

I've got a few tips about it:

  • What Kevin Yank said about the settings file; while you have a Ruby file opened, you can use the menu item under "Sublime Text 2" → "Preferences" → "File Settings - More" → "Syntax Specific - User" to open the config file for that specific syntax; it will be safe to edit there

  • Use some kind of package control, like this one

  • Inspecting the "Sublime Text 2" → "Preferences" → "Key Bindings - Default" file, one learns a lot about available shortcuts, how the editor works internally and even how to easily extend or tweak its functionality

In my opinion, Sublime Text 2 has great potential. I very much like the design concepts in it (multiple carets/selections, all that commands stuff, etc). It's still a bit under-documented and is missing a central place to collect knowledge about itself, but I consider that okay, given the fact it's still in beta. Also, I'm very fond of the transparent development process, in contrast with TextMate's development.

Pablo Barrios
Pablo Barrios says:
01/06/2012 08:41am

Nice post, but let me tell ya that all of this is much easier with Package Control

There is even a Git package that it is really great. BTW, I think that Sublime Text 2 is the "emac/vim" of the XXII Century.


Nick DeSteffen
01/14/2012 11:03am

Thanks for the great feedback and tips guys!

Richard Ortega
Richard Ortega says:
01/18/2012 03:58pm

Great post, adding subl to the CLI was great and couldn't figure it out for the life of me!

My only question is how do you change themes after downloading them (for instance - "Soda Light/Dark")? It downloads to the package folder but it doesn't populate in the theme list.

Nick DeSteffen
01/18/2012 08:03pm


Glad I could help. I'm not really sure how to get the Soda theme working, I gave it a whirl and it didn't work for me either. Maybe you can post an issue with the developer

Dimitar Dimitrov
02/05/2012 06:56am

I'm currently using the Soda Dark theme. I think the instructions in its GitHub page are good. Do this:

I needed to restart Sublime Text 2 to make sure the theme is properly loaded, otherwise the GUI had some glitches. Other than that, it works like a charm.

Glenn says:
08/03/2012 02:38pm

I'm having a less than happy experience so far with my last 2 days using Sublime Text 2. I'm a long-time TextMate user like most people, and I've been spending a ton of time googling and installing packages to try to get me back to on-par of where I feel like I am with TM, and it's just not happening. I just finally got this working so I can run my specs, but it's just the ugly console view. Where's my awesome html output with clickable lines that I'm used to in TextMate? Also, installing the RSpec TM bundle is a 1-liner and poof it's working. This ST2 thing took me a good 10 minutes to get my ugly console output working and a bunch of steps copying over setting files across disjointed directories, copying and pasting changes in setting files, installing a package manager, installing packages. I keep reading articles about how ST is so awesome and I feel like I'm missing the punchline here. This is a complete mess compared to the TM experience. What do I have to do to feel like ST is better than TM? Sorry if I sound like a negative Nancy but I keep reading such amazing hype for ST and I'm just not understanding the appeal and switching has not been fun at all. I am honestly giving it a fair try though!

murty says:
01/11/2013 07:33am

Great post. I am a noobie and not sure if I should be asking this here but I am trying to find this specific information on various forms but can only find fragments of tips and having a challenge to integrate all of them.

I am looking for the following:

  1. A simple (as automated as possible) way to set up test db and run rspec tests from sublime.
  2. When I run the test (one specific rspec file or all of them) it should do the following: a) drop test db b) create test db and do all migrations c) load seed data d) load test data (Factories) e) and finally run the selected tests
  3. All of the above should be done without leaving sublime

Pardon me, if this request does not make sense here. I know that it involves rake db tasks and installing rspec plugin and configuring it in sublime.

If someone has already done it, I would appreciate if you can describe the steps.

Alexandra Ximenez
Alexandra Ximenez says:
01/28/2013 10:45pm

How can install RSpec on Sublime Text 2? I want to be able to run tests from Sublime Text 2 using "command + b" or something like it.


murty says:
01/29/2013 12:37pm


It is already mentioned in the article. go here:

Format using Markdown