OS X: Quick Look for Groovy

March 05, 2009 | 2 Minute Read
This post was originally posted on my old blog.

Update: The info in this post is deprecated, check out my post Quick Look for Groovy with Syntax Highlighting.

Quick Look is one of the coolest features of OS X Leopard.

Unfortunately it only supports a limited range of file types.
I blogged before how I got Quick Look to display .properties files.

Lately I am playing a lot with Groovy... and .groovy files are also not supported by Quick Look out of the box.

Finally I got Quick Look working to show .groovy files. But it has been quite a hassle.

In the following I am using TextMate, but this should also work with another text-editor like Smultron or TextEdit.

This is what I did:
  • I navigated into the TextMate package (right-click->Show Package Contents).
  • I edited Contents/Info.plist with a text-editor.
  • I added the follwing snippet at the end of Info.plist (just before the ending </dict> </plist>)

  • Then I set TextMate as the default editor for .groovy files.

  • Then I did the following steps on the command-line, without really knowing what they do. Probably not all of them are necessary:
  • touch /Applications/
  • qlmanage -r
  • touch ~/Library/QuickLook/QLColorCode.qlmanager
  • /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f -v ~/Library/QuickLook/QLColorCode.qlmanager

  • The result is that QuickLook at least displays .groovy files as plain text:
    Picture 1.png
    Next on the wishlist would be syntax-highlighting. Unfortunately this does not work with the qlcolorcode-plugin since Highlight does not support Groovy.

    Last tip: To find out which Quick Look generator is configured for a file type you can use the following command: qlmanage -p Greet.groovy 2>&1 | grep 'Generator used'

    I collected these infos mainly from here and here. follow me on twitter, I need some friends :-)