The Groovy TextMate Bundle
This page contains the TextMate bundle files that add Groovy & Grails support to the TextMate text editor for Mac OS X. They were originally written by Graeme Rocher (Grails project lead) and are made available as is. Windows users may wish to consider e which is similar to TextMate and supports TextMate bundles.
However, the above link is not the latest code as the Groovy TextMate bundle is now hosted and maintained within the Macromates SVN repository. The details of which can be found here: http://macromates.com/wiki/Main/SubversionCheckout
(Windows users using e: consider using the e mirror which removes the non-cross-platform-friendly characters in the names of some of the snippets)
Copy the Groovy and Grails bundle files to
~/Library/Application Support/TextMate/Bundles and start TextMate. (Windows users using e: use the directory where e was installed, e.g.
The bundles add Groovy and GSP support to files ending with .groovy and .gsp. There is syntax highlighting and code completion with snippets. All of the completions can be found in Bundles -> Groovy and Bundles -> Grails.
It is useful to look at these menus as a lot of the Groovy API is explore-able from there.
Some useful tips:
- type "to" and hit TAB for type conversion by method call
- type "as" and hit TAB for type conversion by coercion
- type "with" and hit TAB for i/o stuff
- typing ea, eawi, eal, eaf, eab, eam and hitting TAB do things like each, eachWithIndex, eachFile and so on
- type "static" and hit TAB for various options for statics
- type "cla" and hit TAB for class definition templates
- typing ":" and hitting TAB creates key/value hash pair
- Use ^ H to access JavaDoc help given you have them installed
- Use ^ ENTER to create new methods
- Use Apple + Run to execute the current file
- Select some text and use ALT + APPLE + Run to execute the snippet
Remember after you have hit TAB you can often TAG through the code the template generates to modify each changeable value.
- Fixed Multi-line Groovy string highlighting
- Added for snippet with key "for" + TAB
- Added Grails bundle
- Initial revision
GantMate allows you to run Gant tasks for your project from within TextMate. It is currently available from here for testing purposes but will be integrated into the Groovy bundle eventually.
Grap the two zips from above. Unzip GantMate.zip and place in
~/Library/Application Support/TextMate/Bundles/Groovy.tmbundle/Support/. Unzip Run Gant Task.tmCommand.zip and double click to install. It should install itself in the Groovy bundle.
The default key mapping is control+shift+g and is scoped to Groovy source files.