Topic: https://brettterpstra.com/2012/03/31/sparkup-system-service-html-shorthand-everywhere/
hide preview

What's next? verify your email address for reply notifications!

Lauri Ranta 12y, 353d ago

I wrote a similar AppleScript last year, but ended up scrapping it in favor of TextMate's Zen Coding bundle. There's no additional delay when the snippets are expanded, you don't have to select the snippet before expanding it, and you can use tab stops.

That, and I think keybindings mostly make up for not having Zen Coding in other editors.

My original DefaultKeyBinding.dict had a macro for expanding a tag with a single attribute as well. (Something like div class⁁<div class="⁁"></div>.) It doesn't override the clipboard or require making a selection first.

"~q" = (moveWordBackward:, moveBackward:, moveWordBackwardAndModifySelection:, setMark:, deleteToMark:, insertText:, "<", yank:, moveForward:, moveWordForward:, insertText:, "=\"\"></>", moveBackward:, yank:, moveWordBackward:, moveBackward:, moveBackward:, moveBackward:, moveBackward:);
remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 12y, 353d ago

Yeah, the keybinding I wrote allows for multiple attributes (the reason it destroys clipboard... needed two different pasteboards to work with, tag and attributes), but it's no replacement for Sparkup, at least in my workflow.

Tab stops are ideal, but not an option in Services, obviously. There's no question I'd never use this in an IDE that supported Zen/Sparkup (the Sublime Text 2 Zen Coding implementation is amazing). This has already come in handy for me in a few other places, though.

hide preview

What's next? verify your email address for reply notifications!