[TxMt] HOWTO: Write powerful snippets

Alex Mason axman6 at gmail.com
Sun Mar 25 00:56:45 UTC 2007


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




More information about the textmate mailing list