Sublime Text 2

19 Sep 2012

After MacroMates announced that TextMate 2 was available on GitHub, I (wrongly) concluded that it was probably going to be abandoned.

Because of that, I began to consider other text editors, and my attention was caught by Sublime Text 2.
Now it’s my main text editor, and here there are few tweaks that let you to improve it.

Enable Sublime in command line

If you want to use Sublime in your terminal, you can add a symbolic link to its executable:

sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl

Type subl --help to check if it works.

Custom icon

Honestly, the Sublime icon sucks.
I replaced it with a new one and then I created a script to automate the change.

  • Download the icon with the script here
  • Run unzip sbicon
  • Execute the script ./mac_replace_icons

Install Package Manager

Like TextMate, also Sublime has its packages. You can install the Package Manager pressing ^+` to open Sublime’s console and copying this string

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'

After relaunch it, you can add new packages pressing ++P and selecting Package Control: Install Package.

There are a lot of packages for almost everything you need, and a lot of TextMate packages are now available for Sublime.

Install custom theme and color schemes

Sublime it’s not exactly beautiful. It’s pretty ugly. Because of that I installed the Soda theme to make this more Mac-like.

You can install it through package manager and to enable it you have to add the line below to your user’s settings +,

{
    "theme": "Soda Light.sublime-theme"   }

There are two different variant of this theme, Light and Dark, both beautiful.

You can use the default Sublime’s chrome-like tabs, but I prefer Soda’s more squared custom tabs

"soda_classic_tabs": false

With Soda I installed also a custom colour schemes, you can download them here.
Unzip and place the extracted .tmtheme files in the Sublime’s Packages/User folder. You can find it under Preferences/Browse Packages.

To activate one of them, add the line

"color_scheme": "Packages/User/Monokai Soda.tmTheme"

in your user’s settings.

image

Beautiful, I know :P

Custom syntax-based prefs

This is the last tip. If you want to have preferences based on programming language you are using (like 2 spaces tabs in Ruby), open the file and set your preferences in Preferences/Settings - More/Syntax Specific

EDIT

The twitter user @iduke84 shared with me its script to open selected files with Sublime Text 2.

Give it a try!