[TxMt] invoking a snippet from a snippet

Allan Odgaard throw-away-1 at macromates.com
Tue Nov 14 15:12:25 UTC 2006


On 14. Nov 2006, at 14:55, Ed Singleton wrote:

>> > I'd also really like to be able to reference tab-stops from the  
>> first
>> > snippet in the second snippet.
>> How would that work?
> Well, using a (grossly oversimplified) use case of a html form.  Let's
> say you have a form snippet and lots of field snippets.
>
> Sometimes you want to prepend the id of the form to the id of the  
> fields:
>
> <form id="my_form">
> <input id="my_form_field_1">
> [...]

Ah, okay -- well, I think the best way to solve this is to instead  
let the snippet be generated by a command, which takes the form as  
input, and extracts the ID. Then the “child snippet” will also work  
as expected, even when not invoked inside the parent one.

But I do like the idea, though would need more use cases for me to  
really be behind it -- but now that you’ve planted a seed, maybe I’ll  
start to see them :)




More information about the textmate mailing list