[TxMt] HOWTO: Write powerful snippets

F. Gabriel Gosselin beyondwords at gmail.com
Sun Mar 25 01:15:54 UTC 2007


I'm always amazed with the feature richness of TextMate (and always  
sure I'm missing a couple).

Thanks for pointing that out. That's exactly what I was trying to do.

I've learned my lesson: I'll go check out more tutorials and cheat  
sheets.

thanks,
Gabriel

On 24-Mar-07, at 8:56 PM, Alex Mason wrote:

> Is ⌘-/ not good enough? Just have the cursor on the line you want  
> commented, and hit that, everything will be commented. Also works  
> for selected text.
>
>
> Al.
> ☠☢✯☢☠
>
>
> On 25/03/2007, at 3:04 AM, F. Gabriel Gosselin wrote:
>
>> 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
>>
>>
>> _____________________________________________________________________ 
>> _
>> For new threads USE THIS: textmate at lists.macromates.com
>> (threading gets destroyed and the universe will collapse if you  
>> don't)
>> http://lists.macromates.com/mailman/listinfo/textmate
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate

F. Gabriel Gosselin
Web Developer - http://www.offcentre.ca
gabriel at offcentre.ca - 514.585.3624






More information about the textmate mailing list