25 Sep
2008

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

Inspired by the Paul Lutus's ruby beautifier script and Tim Burks's post on making it into a Textmate bundle I've put together a Code Beautifier Textmate bundle

It 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.

It's all hosted on Github so if you want to make improvements then please fork away.

Installation

Run this:

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

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

Updated on 21 May 2009

Changed the URL of the repository on GitHub to http://github.com/mocoso/code-beautifier.tmbundle/tree/master to fix a typo in the name (oops).

Comments (4) Feed

  1. Jordan Arentsen wrote on 21|02|2009:

    For some reason I get the following error when I try to clone:

    Initialized empty Git repository in /Users/bre/Library/Application Support/TextMate/Bundles/Code Beautifier.tmbundle/.git/ fatal: protocol error: expected sha/ref, got ' *********'

    No matching repositories found.

    *********'

    Any ideas? I'll just download the .tar and install for now. Never gotten an error like that from github.

  2. joel wrote on 21|02|2009:

    Works fine for me

    $ git --version git version 1.6.0.2 $ git clone git://github.com/mocoso/code-beautifer.tmbundle.git Initialized empty Git repository in /Users/joel/tmp/code-beautifer.tmbundle/.git/ remote: Counting objects: 68, done. remote: Compressing objects: 100% (57/57), done. remote: Total 68 (delta 22), reused 0 (delta 0) Receiving objects: 100% (68/68), 22.38 KiB, done. Resolving deltas: 100% (22/22), done.
  3. sergeych wrote on 16|12|2009:

    Does not work now:

    sergey@localhost:~/Library/Application Support/TextMate/Bundles/Code Beautifier.tmbundle$ git clone http://github.com/mocoso/code-beautifier.tmbundle/tree/master Initialized empty Git repository in /Users/sergey/Library/Application Support/TextMate/Bundles/Code Beautifier.tmbundle/master/.git/ warning: remote HEAD refers to nonexistent ref, unable to checkout.

  4. Joel wrote on 16|12|2009:

    Sergeych, you need to use git clone git://github.com/mocoso/code-beautifier.tmbundle.git (not git clone http://...)

Add Comment

*
* (won't be displayed)

(Use Markdown syntax)