[TextMate] [Tip] Embed selection in tag, lookup PHP functions

Allan Odgaard allan at macromates.com
Fri Oct 8 03:48:32 UTC 2004


James A. Baker asked me for a BBEdit feature where the selection is 
wrapped in a tag, which you pick from a list of tags. But then his 
stream of thoughts derived the following TextMate solution, which I 
think was very neat:

Create this snippet, name it _wtag:
    <${2:tt}>$1</${2:tt}>$0

Then select Start Macro Recording and type:
    cmd-x, _wtag, tab, cmd-v, tab, stop recording, save it for later.

Now you have a macro which wraps the current selection inside a tag 
pair (the default tag name is tt, but you can change it). Press tab 
again after having typed the name to leave the snippet.


Another neat trick I saw on a blog (but unfortunately lost the 
reference) was a command configured to do:
    open http://php.net/$TM_CURRENT_WORD

So simple, and yet so powerful (it looks up the word under the caret in 
the PHP reference documentation).


It's really fantastic to see this end-user innovation, keep it up! :)

Kind regards Allan




More information about the textmate mailing list