venerdì 14 maggio 2010

TextMate Syntax Highlighting Howto: A simple todo list

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.


Textmate help
Mac Dev Center

3 commenti:

  1. Looks nice, and it quite closely recall OrgMode, if you ever wanted tons of feature around your TODO's and wanted to give Emacs a try :)

  2. @skuro
    Yes, you're right, I've read about OrgMode and I even thought about starting learning Emacs for it ;) I think I'll give it a try someday when I'll get tired of TextMate & vim!

  3. thanks very much ... i always wanted to know how to do syntax-highlighting for my very own text format.