‘Make Tag’ BBEdit AppleScript

Marc Liyanage:

I wrote this AppleScript for BBEdit. It takes the word immediately preceding the cursor and makes an opening/closing tag pair with it, e.g. you type “div” and hit the keyboard shortcut assigned to the script, and it will insert

<div<##>><##></div>

The “Go To Previous/Next Placeholder” menu commands, which you should also assign to keyboard shortcuts, take you to the two <##> placeholders for attributes and contents.

I was just thinking about writing something like this after reading about a similar feature in TextMate.

Tuesday, 2 August 2005