[TxMt] Nested snippets

Emmanuel Turquin emmanuel at turquin.org
Tue Sep 12 23:48:06 UTC 2006


  I just started creating my own snippets, and was wondering if it's 
possible to write 'recursive' snippets. Let me give an example: say I 
use the banner snippet from the source bundle:

// ==========
// = Banner =
// ==========

I'm currently in the $1 tab, and instead of 'Banner', I want to use 
another snippet, triggered by base<TAB> and which will extend into, say, 
"All your base are belong to us".

// ========
// = base =
// ========


// ==================================
// = All your base are belong to us =
// ==================================

Once this second snippet is completed, I then go back to the first one, 
where I left it. This far, I haven't found such a nested scopes option 
in the snippet syntax, but since I'm a newb I may have missed it. If 
this feature really isn't available, I think it'd be a valuable addition 
(even though the example I gave is completely phony). We could imagine a 
special syntax indicating wether the current tab is in protected mode - 
as it is now - or if it can be subject to other triggers. For example, 
$1 and $$1 resp. What do you think of it?



More information about the textmate mailing list