How to add Ant and NAnt support to TextMate

How to add Ant and NAnt support to TextMate

(image taken from Dmitry Baranovskiy's photostream)

The moment my 30 day evaluation of TextMate expired, I ordered a copy. The last time I got so enthused about an application that I stumped up the cash for it was about 3 years ago, with Delicious Library. Today I used it to edit some NAnt files. Here's how.

My ancient little Mac Mini already had Subversion. I installed Mono so I could get a working copy of NAnt. You'll need both.

You need to run this in a Terminal window to enable syntax highlighting for both tools:

export LC_CTYPE=en_US.UTF-8
mkdir -p /Library/Application Support/TextMate/Bundles
cd /Library/Application Support/TextMate/Bundles
svn co http://macromates.com/svn/Bundles/trunk/Review/Bundles/C%23.tmbundle
svn co http://macromates.com/svn/Bundles/trunk/Review/Bundles/Ant.tmbundle/
osascript -e 'tell app "TextMate" to reload bundles'

The TextMate bundles repository has some non-ASCII encodings, so the first line just ensures that you have a UTF-8 encoding selected. The middle 4 lines make a directory, and put the Ant and NAnt bundles in that directory. The last line reloads the bundles for you if TextMate is already running. What a pleasant way to do .NET.