How to: Setup Sublime Text 2 for web development

Having received a bunch of comments on my previous post explaining how to setup sublime text for web  development asking me to just write a completely new one for Sublime Text 2 as quite a few things have changed.

So Sublime Text 2 is currently out for beta, you can get it here, and if you bought a licence for the first version you’ll be happy to know it will still work. There have also been some changes on the plugin front, some good and bad. Sadly the WebDevelopment plugin is no longer available, but I feel that the functionality of Zen Coding is sufficient to fill this gap. The good news is there is a swanky new plugin called Package Control.

Package Control

Package Control does exactly what it says on the tin. It allows you to search, browse and install packages (plugins) available for Sublime Text. It will also keep them all up to date without you having to lift a finger. Literally the hardest part is installing it, and even that is easy:

  1. Open up Sublime Text and press ctrl+` which will bring up the console at the bottom of sublime.sublime text console
  2. Next up you want to copy and paste the following into the console:

    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’

    Then hit enter.

  3. When it has finished downloading and installing it will ask you to restart sublime. Do this.

ZenCoding

Installing ZenCoding is now very simple. First we want to bring up the package control dialogue. On Windows go to Preferences -> Package control, on Mac click Sublime Text 2 -> Preferences -> Package Control.

Click Install package and you will be presented with a list of available packages for sublime. We want ZenCoding so you can either scroll down to the bottom of the list, or just start typing “zen” to search for the package. Click on the one you want and woosh, it will install.

Feel free to ask any questions and let me know if you think ZenCoding is alright on it’s own without the old WebDevelopment plugin.

6 thoughts on “How to: Setup Sublime Text 2 for web development”

  1. Thanks for your post, but I can’t find zen coding in the list after I installed Package Control.
    So where can I find it?

  2. Good point, I can’t see it either. I suggest waiting a few days to see if it appears, if not be pro-active and ask the developer or maintainer of Package Control.

Leave a Reply