[TxMt] HOWTO: Write powerful snippets

F. Gabriel Gosselin beyondwords at gmail.com
Sat Mar 24 17:04:08 UTC 2007


Hi,
	I'm looking for a way to crate a simple snippet so that tab  
completion: //(tab) will insert CSS comments and wrap any text on the  
line if applicable.

I've got so far as this:
/* ${1:${TM_CURRENT_LINE/(^\s+)(.+;)/$2/g}} */
$2

Which when you feed something like:
//(tab)some-property: some-value;

Produces output:
/* some-property: some-value; */
some-property: some-value;

What I would like is to delete the second instance. Is there any  
way?  Or, will I just have to settle for selecting the text and  
create a key equivalent snippet (which means I have one snippet for  
plain comment and another for wrapping...).

Oh and one other question about snippets: in the sequence ${«tab  
stop»/«regexp»/«format»/«options»} what are the options? I stuck with  
g because that's what I had seen.

thanks in advance,
Gabriel




More information about the textmate mailing list