[TxMt] new command: Universal Un/Comment (BBEdit-ish)

Allan Odgaard allan at macromates.com
Tue Dec 21 17:28:30 UTC 2004

On Dec 21, 2004, at 16:46, Eric Hsu wrote:

> I missed a command from BBEdit that let you comment and uncomment text  
> magically for different languages with the same keystroke  
> (Text->Un/Comment), so I wrote a version for TextMate. [...]

Nice! :)

I changed the extension-grabbing code to this: “($t)=/\.([^.]*)$/” to  
handle paths with multiple dots and I quoted TM_FILEPATH (for paths  
with spaces).

I also added: "cc,mm"=>["//","","/*","*/"] and m+h to the plist,c types.

So it's now: perl -e  
,$k)){$c{"$_"}=$v;}}$_=shift at ARGV;($t)=/\.([^.]*)$/; 
($s,$f, at etc)=@{$c{$t}};$b=0;while(<STDIN>){push at in,$_;($in)=/^([  
^(\s*)$s(\ )?/$1/;s/(\  
)?$f(\s*)$/$1/;$o.=$_.$n;}else{s/^$ind//;$o.=$ind.$s." $_  
".$f.$n;}}print$o;' "$TM_FILEPATH"

> If there is enough interest, I will release commented source code and  
> make it into a nice .tmbundle.

Sounds like when you do, I should add that bundle to what's included by  
default with TM (if you don't mind)! :)

More information about the textmate mailing list