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)
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.