Sublime Text is becoming a popular choice for Drupal developers, and for good reason - it's a fantastic code editor, works great with PHP (especially the new code navigation features in Sublime Text 3) and it's easy to configure for Drupal development.
Having come to Sublime Text from Vim, one thing I missed in Sublime Text was the proximity to the command line, and especially Drush, when working on a site. The ability to make some changes and, for example, type
!drush cc all or
!drush sql-query is really useful and saves me time switching contexts between the terminal and the editor. (Incidentally, the Vim Plugin for Drupal has nice Drush integration, and was a helpful conceptual guide when writing this plugin.) To fill this gap, I wrote the subDrush plugin for Sublime Text 3. The plugin provides a **sub**set of **Drush** functionality within ST3. The idea is not to provide support for all Drush commands, because there are many Drush commands where this doesn't make sense (e.g.
sql-sync) - but there are quite a few that are convenient to run from within the code editor, and some are even more functional, in my opinion, when run from within ST3 (like the
php-eval command) than in the terminal. Hats off to the developers of Drush 6 who have made it a breeze to integrate Drush with third-party applications. The initial release of subDrush (0.1) contains support for the following commands:
||Clear a specific cache bin||core|
||Clear all caches||core|
||Provides a birds-eye view of the Drupal installation||core|
||Displays the 10 most recent watchdog entries||core|
||Displays the value of a Drupal variable||core|
||Invokes cron for open Drupal director||core|
||Evaluates selected text in the bootstrapped Drupal site||core|
||Executes open buffer as PHP script after Drupal bootstrap||core|
||Show a list of available extensions (modules and themes)||core|
||Edit the Drush aliases (current site or choose from list)||custom|
Access the commands by opening up Sublime's Command Palette (
Ctrl + Shift + P) and typing "drush".
All of the commands run asynchronously, so, for example you can execute
Drush: PHP-Eval and continue with your work - when the results of executing the code are ready, they'll be presented in the build output panel. You can also run multiple
subDrush commands at once (e.g.
Drush: Cron followed by
Drush: Watchdog Show to see the results).
Here is a brief screencast walking through some of the features of the plugin (please select HD when you're watching). Note that since the screencast was recorded, I've added syntax highlighting to most commands so the results returned from Drush are easier to review:
Support for additional commands is planned for future releases - check out the issue queue to get more information and submit requests for new features.
To install the package, you'll have to clone the git repo into
/Packages. (Update: The plugin was added to Sublime Package Control, so installation is as simple as going to
Package Control: Install Package and typing
subDrush.) You'll need Drush 6 and Sublime Text 3 for the plugin to work correctly.
Head on over to the project page to find out more about the plugin and documentation for its usage - I hope you find it useful in your Drupal development!
Thanks for extending the Drush ecosystem. This looks awesome.
FYI have a look at the newish core-conf command which helps editing alias files, drushrc files, settings.php files, etc. It has support for $EDITOR so should open up files for editing in ST though I am not familiar with its plugin system.
Thanks Moshe. I've been looking at the core-config command and plan to add some support for it in the near future.
Great one... i was finding about core-status. here, i got everything sublime text. best one.