Getting Started With Sublime Text 2 Package Control

Posted on: October 26th, 2012

Be sure to change to HD for best viewing.

Sublime Text 2 Package Control is one of the coolest parts of Sublime Text 2. It allows you to install “packages” or add-ons that help increase the experience of coding. From things like TidyPHP and CSSComb, you can start coding more efficiently once you get your package control going in Sublime Text 2.

To start, open Sublime Text 2 and press command+shift+` and the terminal inside of Sublime Text will pop up. From there, copy and paste the following code:

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'

If you don’t want to copy it from me, you can grab it on the Sublime Text site.

After you add the code press ‘Return’ or ‘Enter’. Package Control should now be installed. You’ll want to restart Sublime Text to make sure it all went as planned and then re-open it. Once you’ve re-opened press command+shift+P and you’ll see a small dropdown in the middle of your screen at the top. Start typing “package” in and see what it does. If you’ve installed everything properly, you should see a bunch of options for package control.

We’re going to ignore most of those for now and I’ll go over them another time, but for now, either type “package install” or just click “Install Package” after you type in Package. You’ll see a lot of different options after you get to the install package menu, so wade through and find one that sounds interesting.

In the video above I installed “Additional PHP Snippets” since I use PHP a lot of the time. You won’t really notice this package being installed unless you remember every single snippet that was previously installed, but as you move along in your code you’ll notice that Sublime Text does a nice job of trying to finish your functions for you.

Later on I’ll be adding some packages that I enjoy, showing how to install them and then how to activate them.

Enjoy the packages! It’s like Christmas!

Tags: , , , , ,

previous post: Twitter Status With PHP and Twitter JSON (snippet) next post: Csardas Dance Company