[TxMt] Re: Just starting to call myself a full time TM uses, general

Tobias Jung newsgr at tobiasjung.net
Sat May 2 14:01:42 UTC 2009


Scott Haneda <talklists at newgeo.com> wrote (Thu, 26 Mar 2009 05:13:06 -0700):

> Is there a native way to do brace reformatting?  I believe it is  
> called "cuddling".  I often pull a function from here or there, and  
> the formatting is not to my liking...
> 
> function {
>  # code
> }
> 
> versus
> 
> function
> {
>  # code
> }

I tried to do this using regular expressions, too, but I kept failing.
Maybe there _is_ an easier solution, but here is what works great for me:

I downloaded Beautify PHP from
<http://www.bierkandt.org/beautify/>

Then I added a Bundle Command in TextMate with:
----------
Save: Nothing
Command(s): php /path/to/beautify_php -v 0 -l -b 1
Input: Selected Text or Document
Output: Replace Selected Text
----------

Note that the correct file is "beautify_php", NOT
"beautify_php.php" (which is also contained in the Beautify PHP package).
And of course you might want to change the parameters given in the
command line.

Kind regards,
Tobias Jung





More information about the textmate mailing list