[TxMt] Re: Wrap Selection as Link

Brandon M Fryslie bmf at email.arizona.edu
Wed Jul 27 18:22:40 UTC 2011


I'm not sure which command you are originally referring to, but this is
pretty easy to just whip up in the bundle editor (thank you, TextMate!).
 Create a new snippet.  You can name the snippet whatever, and assign it to
whatever keyboard shortcut.  Just make sure to put 'text.html' in the 'Scope
Selector' field.  This will make sure the keyboard shortcut only activates
when you are in an HTML document*.

So, here is the snippet:

<a href="$1">$TM_SELECTED_TEXT</a>

Just paste that into the bundle editor window (get rid of any extra
whitespace), close the bundle editor, and baby you got a stew goin'!
 Highlight some text and press your keyboard shortcut to make a new anchor.
 The caret will be in the quotes where the $1 is.

* More correctly, it will be active when the caret is in a scope of
text.html.  You can check the scope at any time by using a keyboard
shortcut, but I think it's disabled by default.  To enable it, click the
'Filter List...' button near the bottom of the bundle editor, and click the
checkbox by the bundle titled 'Bundle Development'.  Once that is enabled,
press control+shift+p to see a tooltip with the scope hierarchy in it.
 There's documentation about this stuff on the TextMate site if you are
interested in learning more.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20110727/1a26b0b3/attachment.html>


More information about the textmate mailing list