Today I wanted to add a syntax highlight for my todo list favourite format to TextMate.

Here’s how to do it. In TextMate, go to Bundles, then Bundles Editor, then Edit Languages…

Click on the plus button in the lower left corner and choose “New Language”. Paste the following code in place of the example code provided.

This defines three patterns for each condition. They should be self-explanatory, I used only simple regexps here. Save your language definition, and it should appear in the languages combo of your Textmate.

To complete syntax highlighting, you also have to add the colors to your current textmate theme. In the application menu, go to Textmate, then Preferences, then Fonts & Colors. For each pattern name, click the plus button and create a new element. It must have the pattern name as scope selector. Choose colors as you like.

References:

Textmate help

Mac Dev Center


Andrea Schiavini

Andrea Schiavini is a Milan based ruby developer