Plugins for other software

No piece of software is perfect. Some software can be extended by writing scripts or plugins for them, enabling third parties to implement extra functionality or in some cases replace things they feel don't work as they should. I sometimes do this as well and this page serves to make those extensions available to anybody who may find them useful.

Coda

For use with Panic Coda, two little Applescript files to quickly select the string at the position of the insertion point (text cursor). Assign either or both of these scripts to shortcut keys and when activated, they change the selection to be either only the contents of a quoted string or the quoted string including the quotes. Both scripts take into account backslash escaped quotes and can handle strings delimited either by single (') or double (") quotes. I find them quite handy to replace attributes in HTML / XML etc. or strings in virtually any language.

To install, download either or both of the script files linked below and place them in the folder ~/Library/Scripts/Applications/Coda. They will show up in Coda's Script menu as "Select quoted string (excl)" and "Select quoted string (incl)". If you do not have this folder yet or the script menu doesn't show, you can enable it with the "Show Scripts menu" toggle in the "General" tab of Coda's preferences dialog.

To assign keyboard shortcuts, go to the System Preferences, open Keyboard section, choose the Keyboard Shortcuts tab and select "Application Shortcuts" from the left list. Underneath the right list, click the + button to add a new shortcut. Select "Coda" from the list of applications and type the name of the script into the "Menu Title" box, assign a keyboard shortcut and click "Add". Personally, I use โŒ˜' for "Select quoted string (excl)" and โ‡งโŒ˜' for "Select quoted string (incl)".

Sublime Text

For use with Sublime Text, two Python scripts as a plugin that, like the Coda scripts above, quickly select the string at the position of the cursor. Sublime Text's multiple selections are supported. Assign either or both of these scripts to shortcut keys and when activated, they change the selection to be either only the contents of a quoted string or the quoted string including the quotes.

To install, download either or both of the script files linked below and place them in the appropriate folder for your Sublime Text plugins. On Windows, that is usually something like C:\Users\Username\AppData\Roaming\Sublime Text 2\Packages\User. The easiest way to get to that folder is probably by selecting "Browse Packages..." from the Preferences menu.

To assign keyboard shortcuts, select "Key Bindings — User" from the Preferences menu in Sublime Text and enter the JSON for your selected keys. As I use Ctrl-' for quoted strings excluding quotes and Ctrl-Shift-' for quoted strings including quotes, I've edited my keymap to be something like:

[ ... { "keys" : ["ctrl+'"], "command" : "select_quoted_string_excl" }, { "keys" : ["ctrl+shift+'"], "command" : "select_quoted_string_incl" } ]