staugaard / code-beautifier.tmbundle forked from mocoso/code-beautifier.tmbundle

A Textmate bundle for beautifying code

This URL has Read+Write access

Mick Staugaard (author)
Thu Sep 17 01:21:22 -0700 2009
commit  40c5fbf8c6ca0a3d1ce7aae28cad8cb56f5ddda5
tree    42eb6dbbaacb2aa996ca83b0b3c5303b16daf1c9
parent  877a054b7209e903de7a0f86db4e1926c31b984d
name age message
file .gitignore Sun Aug 09 11:11:12 -0700 2009 Add spec and spec:rcov rake tasks [Joel Chippindale]
directory Commands/ Wed May 13 21:17:49 -0700 2009 Separated out definition of ruby formatting [Joel Chippindale]
file Rakefile Sun Aug 09 11:11:12 -0700 2009 Add spec and spec:rcov rake tasks [Joel Chippindale]
file Readme.markdown Mon Jul 13 05:54:48 -0700 2009 Tweak text of known issues [Joel Chippindale]
directory Support/ Loading commit data...
file info.plist Fri Dec 05 20:34:51 -0800 2008 Added 'Beautify all changed' command [Joel Chippindale]
Readme.markdown

Code Beautifier Textmate Bundle

Textmate's indent functionality does a reasonable job of formatting your code BUT there is a great deal of room for improvement.

Code Beautifier only supports Ruby at present but does improve upon Textmate's indent functionality, in particular it is better at indenting multiline statements and cleans up white space.

Installation

If you have git installed your machine then run this:

cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/mocoso/code-beautifier.tmbundle.git Code\ Beautifier.tmbundle

Otherwise download the zip or tarball and unpack it in ~/Library/Application\ Support/TextMate/Bundles.

Then select 'Bundles > Bundle Editor > Reload Bundles' from Textmate's menus

Dependencies

The 'Beautify all changed' command relies on

  • Your project using Git for source control
  • The Grit gem being installed

    sudo gem sources -a http://gems.github.com/
    sudo gem install mojombo-grit)
    

KNOWN ISSUES

  • Does recognize strings with custom delimiters
  • Does not handle multiline blocks within implied brackets
  • Does not indent continuing line statements within brackets correctly

Credits

This was based on the ruby beautifier script by Paul Lutus and Beautiful Ruby in Textmate by Tim Burks