After learning to know about Sublime Text 2, it seems to be a perfect companion to VIM and Eclipse, my other favourite editors/IDE:s. Now I also got it set up to debug PHP scripts with Xdebug :) See for yourself:
VIM, with some modifications, is perfect for quickly editing scripts while navigating around in the command line, and is also available virtually everywhere.
Eclipse is of course the standard workhorse for development, but sometimes it just feels to heavy, and even the simplest debug session will require setting up a new project with a lot of settings, defining a workspace etc etc. And this is where Sublime comes in.
Sublime is more easy to work with than Eclipse/PyDev, Eclipse/PDT (PHP) etc for a number of reasons:
The first thing is how it works with folders and project.
In Sublime, most of the time you don't even need a project. It's enough to open a folder (File > Open folder ..., or "sublime <foldername>" on the command line). This will enable the super nice file opening tool (Ctrl + P), that suggests (and previews in realtime) files as you type (with powerful fuzzy-search), which is really handy when you forgot what that file in your project was named.
On the other hand, setting up a project is also very quick and easy. Just use the "Open Folder" feature as described above, and then go "Project > Save Project As ...". This will add one setting in the project definition: the path to the folder. For configuring Xdebug for PHP debugging (more info on installing the required extensions further below), you just need to add a remote URL setting. This is what I configured for working with my RDFIO SMW extension (accessed with "Project > Edit project"):
{ "folders": [ { "path": "/var/www/smw/w/extensions/RDFIO" } ], "settings": { "xdebug": { "url": "http://localhost/smw/wiki/Special:RDFImport" } } }
I really like the "code miniature" that you see to the right when having a file open, so that you get a graphical hint of how the file looks, and where you are. Actually in some ways better than a code outline feature like in other editors, since the "graphical structure" of the code seems easier to recognize for the brain, than the logical, at least for me.
I hade trying to figure out how to write that method that makes you python file automatically run the main method, so that you can have it at the top ... In sublime I just go Ctrl+Shift+P and start writing "main()" in a python file, and I will find it right away.
Otherwise, I really like the autocompletion of both keywords and brackets and stuff. It is helpful and seem to just work, a lot more often than many other editors.
Something I really miss in Eclipse is easy zooming of the text size. I have quite bad eyes, and sometimes need to really zoom up the text size a lot to be able to work at all. Ctrl + + and Ctrl + - is all you need.
I'm very happy about this. The shortcuts for navigating around in vim are quite hard to beat, even for sublime. Happily enough, sublime has the (vi)ntage mode, so that you can use the most common vim shortcuts within sublime itself.
All in all, Sublime makes me feel more productive than I (think) I have been before!
Setting up Xdebug to work with Sublime requires a few steps, but it's not too cumbersome.
Note, this assumes you use Linux Mint (or maybe some other recent Ubuntu based distro).
Install xdebug. Should be enough with something like:
My file looks like so:
zend_extension=/usr/lib/php5/20090626/xdebug.so xdebug.remote_enable=On xdebug.remote_host="localhost" xdebug.remote_port=9000 xdebug.remote_handler="dbgp" xdebug.remote_autostart=1 ;xdebug.remote_log="/tmp/xdebug.log
Check out the SublimeXdebug Sublime plugin from https://github.com/Kindari/SublimeXdebug and place it in ~/.config/sublime-text-2/
cd ~/.config/sublime-text-2/ git clone git://github.com/Kindari/SublimeXdebug.git .
{ "folders": [ { "path": "/var/www/myapp/" } ], "settings": { "xdebug": { "url": "http://localhost/myapp/index.php" } } }
That's it, I think!