As a recent refugee from Aptana Studio, I’ve spent some time working with Sublime Text for the past couple of weeks and so far I’m loving it (thanks, Yosh!) I won’t get too involved with the reasons I chose to turn my back on Aptana, but let’s just say that the last few updates made the already monolithic IDE an even less responsive experience on my more-than-adequate Core i7 laptop.
With yesterday’s official release of Sublime Text 2 I thought that it would be a good time to share some things that I’ve grown to love about working with it.
- Have you seen it? It’s glorious.
It’s probably one of the best looking text editors around, there are plenty of themes available and it’s pretty easy to customize if you’re so inclined.
- It’s on everything.
I’ve used Sublime Text 2 on OSX, Ubuntu 12, and Windows 7. On each environment it looks delicious and…
- It’s super fast.
I’ve heard legends of Sublime Text opening a several-tens-of-thousands line XML document in less than 20 seconds and scrolling the entire contents beginning to end without so much as a hiccup. Soon to be former-Aptanalistas will be perplexed and amazed. Switching between files is also super snappy.
- It’s pluggable.
There are a ton of plugins available that make using Sublime Text ideal for Drupal development. It also supports Textmate Bundles.
- All the cool kids are doing it.
If you’d like to take a test drive, you may be interested in this handy shell script I whipped up that will set up your Sublime Text editor for Drupal development by adding a few choice plugins and settings (see below).
Configuring Sublime Text 2 for Drupal
Below you can find a bash script I wrote for setting up my Sublime Text development environment. Before you decide to run it you should be aware that there are some prerequisites, including the following assumptions:
- You are on Linux or OSX
(Sorry Windows users, the good news is all of these packages are available to you, you just have to install them manually or through the Sublime Text Package Manager — which by the way works for OSX and Linux, too.)
- You have a working version of PHP_CodeSniffer + DrupalCS (Documentation: How to install DrupalCS).
- You have git installed.
- You have Sublime Text 2 installed.
Update 6/29 — Package control has been added to the build script.
- Package Control
A full-featured package manager that helps discovering, installing, updating and removing packages for Sublime Text 2. It features an automatic upgrader and supports GitHub, BitBucket and a full channel/repository system. The author of Package Control maintains a directory of community and his own packages on his site, several of which are featured in this post.
Brings extra attention to code brackets by highlighting them and placing a small icon to the left of the code block you’re currently working on.
Makes writing JSDoc comments and PHPDoc comments a breeze.
Visually underlays hexadecimal, rgb or named CSS colors inline.
Opens your browser to the Drupal API for the currently highlighted word. Just hit Cmd+Shift+P (Ctrl+Shift+P on Linux/Windows) and type Goto.
A Sublime Build System for running Drupal Code Sniffer on your Drupal files. Orginally forked from https://github.com/sirkitree/DrupalCodingStandard, this version is modified to display the output of phpcs in a friendlier-to-Sublime format. Set the Build mode to DrupalCodingStandard and hit Cmd+ B (Ctrl+B on Linux/Windows) on the file you’d like to process.
Provides autocomplete functionality for most most Drupal hooks. Start typing a Drupal hook and this plugin will automatically name, comment, indent and typically set up any commonly used variables when you use tab complete.
Contains basic configuration for Drupal coding standards such as whitespace rules. Originally posted on drupal.org.
git clone https://github.com/phase2/sublime-drupal.git…and bash SublimeDrupal.sh!
* Disclaimer: this script will override any previously specified configuration data in your user preferences. A backup is created in the directory the file is stored in.
RJ, I can’t believe you’re not using ______________.
Have I missed anything here? Is my script completely busted? Let me know what plugins/tips/editors I need to try in the comments section, or via pull requests to https://github.com/phase2/sublime-drupal/ and I’ll update this post with your recommendations. Maybe you have a better setup and would like to show me around. Maybe you’d like to re-re-re-start a vi/m vs. emacs flame war (just let it go already). Whatever it is, let me know. I also appreciate pictures of cats.
Sign up for the Phase2 newsletter for exclusive content and news.