Setting Up Sublime Text 2

| Comments


Sublime Text 2 Logo

Sublime Text 2 is an incredibly fast and powerful editor that's been replacing vim), emacs, and textmate for many. The community and ecosystem is passionate and vibrant, with developers writing packages for nearly everything. It's also freely available for all three major platforms, which makes it ideal for this class. You can download Sublime Text 2 from its website.

Package Control

Sublime Text 2 supports Textmate Snippets, Syntax Highlighting, and other packages that made Textmate successful. However, Sublime Text 2 did not include a package manager out of the box. Developer @wbond has created a full-featured package manager that helps discovering, installing, updating and removing packages for Sublime Text 2.

To install Package Control, open up Sublime Text 2, and hit ctrl+' or click on View > Show Console to open up the Console. Once open, paste in the following command:

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(''+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'

Note: ignore the text displayed in the console shown above.

Press enter to execute the code. Sublime text should display the message

Please restart Sublime Text to finish installation

After restarting Sublime Text 2, you should be able to use Package Control. For more detailed instructions on installation, see the Package Control Installation Guide.

You can access all the Package Control Commands with Sublime Text's Command Palette, which you can bring up with Control+Shift+P or Command+Shift+P on Mac.

Command Palette

A detailed description of each command can be found here.


Sublime Text natively supports JavaScript, Ruby, Scala, Erlang, Clojure, and Haskell.


For Prolog, a syntax highlighting package has been created by @alnkpa. It can be installed by using Install Package from the Command Palette, which will bring up a separate window that lists all the available packages after a few seconds. Type in Prolog in the search and you should be able to see the package after a few key strokes. Select the Prolog package and press enter to install. Then that's it.

Sublime Text will recognize files that with the extensions pl or pro as Prolog source files. However, pl is commonly used as an extension for Perl and Sublime Text will select Perl as in the language instead of Prolog if you use a pl extension. As a result, we prefer to use pro.

Prolog Package

As a side note, you can set the syntax of any source file at any time by using Command Palette > Set Syntax: (Language) to set the syntax of the current file to the language of your choice.


A package for Io has actually been created by one of the instructors @yangsu. Used Install Package to install a package called Io Langugae.

After the installation completes, Sublime Text will recognize any file with io extension as io source files. As noted above, you can also set the syntax of any source file to io with Command Palette > Set Syntax: (Language).

Additional Resources

Tuts+ is an amazing collection of resources for almost everything related to technical or design knowledge. It's highly recommended for anyone trying to learn anything from Photoshop to Node.js. Tuts+ also has a whole network of sites with focuses in particular areas. Scroll to the bottom of the Tuts+ page, and you will be able to see all the available options.

NetTuts+ in particular has many great tutorials on Sublime Text. Two of the best articles are Sublime Text 2 Tips and Tricks and Essential Sublime Text 2 Plugins and Extensions.

You can also follow a free video series by Jeffrey Way on Tuts+ that goes over many of the topics covered in the two articles above and more.