At last! Galvanized by bug fixes and minor improvements, I finally tackled my two biggest wishlist items for my Textmate Emulation Applescripts for Coda: Wrap Each Selected Line in Tag and Indent New Line. Download the updated scripts, or read on for the details.
Wrap Each Selected Line in Tag does about what it sounds like. Select a bunch of lines, run the script, and you’ll get a dialog where you can enter the tag and its attributes (identical to the current Wrap Selection in Tag). Once you’ve entered your tag, the script will wrap all of the lines with it (and ignore lines that are nothing but whitespace). This is incredibly handy for creating lists.
Indent New Line isn’t inspired by anything in the Textmate HTML bundle; rather it’s inspired by Textmate’s automatic indenting. When you run the script it will take your cursor (or any selected text) and stick it on a new line at one more level of indentation (based on what you’ve selected in the Coda preferences). This script is a great complement to Insert Open/Close Tag: type div
, run Insert Open/Close Tag, and run Indent New Line to end up with:
<div>
|
</div>
(pipe represents cursor)
Indent New Line is also super useful for keeping your indentation clean when working with Javascript functions; just type your curly brace and run the script to get a nicely indented place to start coding.
I have now completed all my “must-have” items for TEA for Coda, so let me know if you have any favorite actions from Textmate (or elsewhere) that you’d like to see added to the bundle. I’m always open to suggestions. As always, you can get the most up-to-date info about the script on the dedicated TEA for Coda page.
This is VERY cool. Forgive me for my ignorance, but is there any way to have these scripts show up in the plugins menu of Coda? I would love to configure a shortcut to the “Wrap each selected line…” script. Either way, well done, thanks for the resource!
Posted 5:50 AM on May. 6, 2009 ↑
Hey Travis,
I’m currently working on a version of TEA for Coda that will show up in the Plug-Ins menu, but at the moment you can still configure keyboard shortcuts using the System Preferences Keyboard and Mouse pane. There should be basic instructions on how to do this included in the ReadMe, but let me know if you have any problems!
Posted 7:41 AM on May. 6, 2009 ↑