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

Allan Odgaard allan at macromates.com
Fri Oct 8 05:01:14 UTC 2004


On 8. Oct 2004, at 5:48, Allan Odgaard wrote:

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

Pressing ctrl-w first (select word) will make it work for the current 
word (w/o a selection), and if there's already a selection, it will 
expand the selection to word boundaries, which it most likely already 
is.  So this makes it easier for single words which needs to be 
embedded.

> Another neat trick I saw on a blog (but unfortunately lost the 
> reference) was a command configured to do:

And here's the link: 
http://sneer.org/archives/2004/10/06/textmate_first_impressions/


Kind regards Allan




More information about the textmate mailing list