Sublime Text 2. So good.

February 20th, 2012 | Adam Johnson

Sublime Text 2 is a text editor and it kicks ass. For the longest time I looked for a text editor that was similar to TextMate but worked on Windows. Not only does Sublime Text 2 work on Windows, it also works on Mac and Linux, it's fast, and supports everything TextMate does. In this post, I'll tell you some reasons why you might want to switch from Textmate to Sublime, how to get up and running with Sublime, and some tips and tricks that'll make you love it even more.

So what’s the deal with Sublime?

What’s all the fuss about? Why do I like Sublime and what’s it got on Textmate?

Pros:

  1. It works everywhere. I can use it at work on both of my Macs and at home on my PC. If I used Linux, it’d work there too.
  2. Buy it once, use it everywhere. Buy one license at $59 bucks and you are good everywhere. Don’t worry, you can use the free trial as long as you want.
  3. Smart indentation and tabbing. This one is subtle and is something I have not found in TextMate. When you tab, a grey line appears helping you visually see where start and end tags are.
  4. Code auto completion. Writing a class or ID over and over? Sublime will remember it for you as you begin typing. Hit enter after the first few letters and it’s there.
  5. All TextMate bundles and themes work with Sublime. FTP, SVN, Git, whatever you want, it all goes.
  6. It comes recommended by folks like Nettuts, Lifehacker, and, well, me.

Cons:

  1. The icon is damn ugly. Fortunately, there’s a new icon coming out that’s in the nightly builds. The new icon is out! Check it out or see what people have come up with for some kick-ass alternatives on Dribbble.
  2. Their site needs some love too. From the looks of their site, you’d probably pass it over and never look back.

That’s enough to get you started. In truth, the best way to see if you’d use it is to try it out. There’s a free trial and it’s a super lightweight program, so you’ve got nothing to loose. Give it a whirl.

Tweaking Sublime

When I first started using sublime, I needed to tweak a few things. Sublime lets you tweak pretty much anything you want. Many of these fine-grained details are edited via a code-based config file. Don’t be scared. It’s all copy and paste. Here’s a list of what I tweaked:

  1. One of the first things I noticed about Sublime was that it kept the last files you had edited open, even if you closed the program. I didn’t like that, so I disabled it by going to Global Settings > User and pasting:

     // Place user-specific overrides in this file, to ensure they're preserved
    // when upgrading
    {
    // Exiting the application with hot_exit enabled will cause it to close
    // immediately without prompting. Unsaved modifications and open files will
    // be preserved and restored when next starting.
    //
    // Closing a window with an associated project will also close the window
    // without prompting, preserving unsaved changes in the workspace file
    // alongside the project.
    "hot_exit": false,
     
    // remember_open_files makes the application start up with the last set of
    // open files. Changing this to false will have no effect if hot_exit is
    // true
    "remember_open_files": false
    }
  2. I keep all of my Sublime user preferences stashed on GitHub. There’s some neat stuff there, I’d recommend checking it out.

  3. Nettuts did a great write-up of tweaks for Sublime. Definitely check out Package Control. It’s the bread and butter of the app.

  4. Create a hotkey to toggle word wrap on & off.

  5. Automatically convert spaces to tabs: View > Indentation > Convert

  6. Get a new, waaay more badass icon on Dribbble. There’s instructions on GitHub, but you’ll need ResEdit in order to change the icon on Windows. (Update: They changed the icon in 2012 and it’s a vast improvement. That said, alternate icons are still cool).

  7. Sublime comes with a few code color schemes by default. Most of them are dark. I’m a light color scheme guy myself and, using Dreamweaver code view before Sublime, found the Textmate Dreamweaver theme fitting for my PC. If that is not your slice of life, there’s plenty more color schemes in the TextMate Wiki. Other light color schemes I liked were Mac Classic Modified, Prospettiva, and Tomorrow—although I’m starting to like Blackboard.

  8. Speaking of color schemes, I found the Phoenix Sublime Text theme and switched immediately.

  9. Minimal Design’s HTML and CSS bundles allow you shortcuts for some tags and properties. I don’t at this time use it with Sublime, but I did use them with TextMate.

  10. I’m a big fan of Concrete5 CMS. Handily, there’s a snippets bundle for Textmate/Sublime with everything you’d need and more. Install the concrete5.tmbundle folder to /Packages/User. You can access the Packages folder by going to Preferences > Browse Packages.

  11. Since you just installed some sweet snippets, why not create a hotkey to access snippets.

Update January 4th, 2013:

There are a couple of packages that I’ve found recently that I can no longer live without. Here they are:

  1. Emmet lets you be a speed ninja for HTML, CSS, and so much more. Want a margin-left of 10px? Type ml10 and hit Tab and viola, Emmet will expand it for you. Install via package control. Don’t forget to check out the repo & docs.

  2. The ”Increase & decrease values” package sounds nerdy but it allows you to increase a value (eg 1px) by 1, 10, or 100 with a simple keystroke. Crucial.

  3. SideBarEnhancements brings everything you ever wanted and needed to the right click of the sidebar. Install is simple via Package Control.

So that’s a pretty good list to get you started. Zander Martineau also has a fantastic starter guide for Sublime which he’s put on GitHub. But the real question is, “What do you think?” Have a go and decide for yourself.


I’ve recently removed comments from this blog. Want to chime in? See something wrong?
Email me at Email me!. I’d love to hear from you. I read every email and welcome your input.