Setting Up Sublime Text 2 For PHP Development
Wow. Last week's opinion piece about switching from Netbeans to Sublime Text 2 has been the most popular blog post I've written for quite a while.
As the interest seems to be there, I thought it would be a great idea to follow up with a post taking you step by step through how I've set up Sublime Text 2 for PHP development, and showing you some of the useful features that you get out of the box with Sublime Text 2.
You'll find the details below, and as a bit of an experiment, I've also put the details together in a series of YouTube videos for those folks who'd prefer to see ST2 in action. The video directly below is the first in the playlist, and I've also put the video for each feature separately further down. If you like the videos, please do click the aLike' button on YouTube so that I know :)
Tip: If you can't see any YouTube videos on this page, you might need to switch off your browser's AdBlock plugin and then reload the page.
Install Package Control, Soda, And A Syntax Highlighting Scheme
Out of the box, Sublime Text 2 is a very good text editor. It's so good, in fact, that I've seen people use it in its vanilla form perfectly happily for days and weeks before realising that it can be enhanced with third-party plugins!
The first plugin I recommend installing is Will Bond's Package Control (installation instructions). Package Control is a plugin that automates the job of installing and upgrading plugins. After you've installed it, restart ST2, and then you'll find a new aoPackage Controla menu option at the bottom of the aoPreferencesa menu.
There are over 200 community plugins currently available for ST2. You'll find them by going into Package Control and selecting the aDiscover Packages' option. This takes you to the community packages webpage, where you can browse or search through the available packages. It's worth going back and checking this page from time to time, as new packages are being added on a regular basis.
The next thing I normally do is reskin ST2. This is entirely a personal preference! Using Package Control, install the aSoda' Theme plugin; this downloads the plugin, but does not activate it. Then, open up the aSettings - User' preferences file (this is a JSON file), and add
Finally, I setup syntax highlighting to suit. ST2 ships with a number of these, and you can (if you wish) feed it any colour scheme originally created for TextMate. I prefer to use the aPhix Color Scheme', which is available through Package Control.
Editing User Preferences
In ST2, nearly all of the configuration is done by creating and editing config files. There are no user interfaces to click through, just JSON files to edit by hand. There are a few of these files, and the basic idea is that there's nearly always a adefault' config file (which contains the defaults that ST2 or its plugins ship with), and auser' override files.
If you go into the Preferences menu, you'll see a aSettings - Default' option. This opens the default settings file that ST2 ships with. It's very well documented, and well worth a browse through to see if there's anything in there that you'd like to tweak. Don't make changes to this file; instead, open the aSettings - User' option on the Preferences menu, and put your changes in there. That way, your preferences will be preserved between ST2 upgrades.
Finding Classes With The Goto Anything Pane
There are two ways you can open files in ST2. One way is to navigate through your list of folders in the Project pane on the left hand side of the screen, clicking around with the mouse and drilling down to find the file that you're looking for. It works a but there's a faster alternative.
Hitting CTRL+P (CMD+P on the Mac) opens up the Goto Anything pane. Here, you can type in the name of the file that you're looking for, and in real time, you'll see a list of matche
Truncated by Planet PHP, read more at the original (another 11522 bytes)