Saturday, October 27, 2007

Tweaking TextMate Groovy Bundle

When using TextMate to work with Groovy code, I use the Groovy Bundle. When you run your code, the default behavior of the bundle is to popup a window and display the results in it. This can be a minor inconvenience to problems at times. For one, to quickly see the output especially during a presentation, I find the popup window annoying. Furthermore, the output may not be what you want to see. Take the example of the following Groovy code (saved in sample.groovy):

bldr = new groovy.xml.MarkupBuilder()

bldr.html {
body {
h1('foo')
}
}

When you press Apple R to run it, the popup window shows "foo" instead of the actual HTML output.












A little tweak to the bundle can fix this problem and make things more convenient. In TextMate, go to Bundles -> Bundle Editor -> Show Bundle Editor and navigate down to the Run command under Groovy.



















Change the exit_show_html to exit_show_tool_tip. Close the Bundle Editor and back in the TextMate editor, press Apple R to see the output appear as tool tip.

1 comment:

elbicho said...

That's nice, I was looking for this,
thanks