Sublime Text 2

Early last year, I blogged about TextMate, which I referred to as my “new IDE of choice”. Embarrassing choice of words really, since TextMate is anything but an IDE. That was primarily what drew me to it. It is a text editor with some extra features, and much more lightweight than a typical IDE. I was happily using TextMate for day-to-day work up until a number of months back when I switched over to ColdFusion Builder 2.

I’ll say up front that I’ve never really been a huge fan of Eclipse in general, which is the framework on which ColdFusion Builder is based. I think it’s a great framework, but it can be quite the resource hog. Yet I started using ColdFusion Builder because my boss used it, and seemed to really be a fan. I figured he knew something I didn’t (which is often the case), and that I just needed to start using it and getting used to it. I was sure that after a few weeks, I’d be over the hump and happily coding away.

It’s been pretty close to a year now, and I still don’t feel comfortable with Builder. It still feels like I’m trying to like it. But it still sucks up quite a bit of RAM, CSS editing is a chore (we have a few _very_ large CSS files that Aptana chokes on), and the keyboard shortcut for commenting a block of code is:

* not intended to be a factual statement

Additionally, some things that I had gotten used to with TextMate weren’t present in Builder. I was used to a closing bracket/curly brace/parentheses being auto-inserted, and me being able to type over that character. But in Builder I kept ending up with 2 closing elements. I eventually turned off the auto-close feature. Long story short… it just never really flowed for me. It never felt “right”.

Over the past couple of months, I’ve seen a number of people talking about a fairly new editor called Sublime Text 2. I finally took the time to give it a test drive, and suddenly I remember what it feels like to actually enjoy an editor.

First off, here’s a screen shot of how I currently have Sublime set up:

I’ve traditionally used a light theme (dark text, white background), but have been wanting to move to a darker theme, as it’s supposed to be a bit easier on the eyes, and I’ve had a history of eye problems due to staring at a computer monitor for 8 to 12 hours a day. I’ve tried darker themes in CF Builder, but there was still a lot of light chrome around the actual editor window. With Sublime, it’s a very minimalist screen to begin with, so applying a dark theme renders the entire application window dark. I recognize that theme and color scheme preference will be highly subjective, but to me… this is truly stunning and doesn’t seem to result in my eyes drying out nearly as frequently as a lighter scheme. Of course, if a lighter scheme is your preference, those exist as well with Sublime.

To get this particular look, I had to install a couple of additional packages:

  • To get CFML syntax/code completion, I installed coldfusion-sublime-text-2.
  • The dark theme is soda-theme. You can find a corresponding light theme with it as well.
  • The color scheme is “Tomorrow”. The specific scheme I’m using is “Tomorrow-Night”.

I’ve only been using Sublime in the “real world” for a couple of days now… but here’s a list of “Charlie likes” items so far…

  • Split Screen editing. You can add up to 4 columns or 3 rows. Or, a 2×2 grid. You can find this under View -> Layout.
  • “Goto Anything”. CMD+P (CTRL+P on Win/*nix) opens a dialog window into which you start typing a filename. The file in question could be 12 directories deep relative to the file you’re currently editing. Doesn’t matter. It’ll open directly.
  • Similarly, CMD+R (CTRL+R on Win/*nix) opens a dialog window allowing you to jump to a specific function within the current file. Handy if you know you need to edit the getFoo() function. You an also simply arrow up/down with this dialog window open to navigate from function to function.
  • Courtesy of Justin Carter on Twitter, type “lorem” and hit TAB for a full paragraph of “lorem ipsum” text :)
  • Something I liked in TextMate that’s also in Sublime is the ability to highlight text and hit a quote to enclose the entire string in quotes.
  • As mentioned earlier, closing parentheses/curly braces/brackets are automatically entered, and I can type over them.
  • There’s a git plugin that has some nice features, such as seeing all commit messages for the file you’re currently working on.

I know that some of the items mentioned above are also available in Eclipse/CF Builder. I don’t mean to suggest that Sublime Text has these features and Eclipse/CFB does not, but rather the fact that I can get the same features in a lightweight editor rather than a resource-intensive IDE.

One last “feature” that I discovered yesterday, which in my mind really sets Sublime Text apart from other editors. My “day job” is working on single code base that powers numerous sites, all with different “skins”. Each “skin” has its own “stylesheet.css” file. Yesterday I needed to update those files. Had I been in CF Builder, my open tabs would have looked like this:

A bit confusing in trying to figure out which file is which.

In Sublime Text, here’s what it looks like with a single tab open:

…but note what happens as I open additional files with the same name:

As I open additional files of the same name, Sublime adds the path to the tab (including updating the text on the currently open tab) so as to help differentiate between the files. It’s the little things like that that make all the difference in the world.

The last thing to like about Sublime Text 2 (for now), is that it’s available on OS X, *nix, and Windows. And the cost of a license is per-user, not per-machine. So I can jump back and forth between my Mac and my Ubuntu netbook and keep a consistent work environment.

Any other Sublime Text 2 users? Anything you like (or dislike) about it that you’d like to share?