I have always been using text files to manage my todo lists but only recently been enlightened of the Todo.txt concept. This post will teach you how to write and deploy a markup definition file for TextWrangler on Mac so it will automatically highlight your Todo.txt like this:
Tools I use:
Notes on the tools:
The concept of the Todo.txt is very simple. There are only 3 rules to follow:
- Priority e.g. (A), (B), (C) and I added (U) for undecided
- Project e.g. +Health
- Context e.g. @home
To make sure that TextWrangler highlights my Todo list as I wish, I wrote a .plist (property list file) for my installation of TextWrangler on my Mac. What is TextWrangler? It’s a text editor that offers much more functionality than Notepad. It’s a Mac equivalent to Notepad++ – my favourite text editor on Windows OS. I would suggest any programmer to use TextWrangler.
BBEditDocumentType CodelessLanguageModule BBLMLanguageDisplayName To Do BBLMLanguageCode ToDo BBLMColorsSyntax BBLMKeywordList (A) (B) (C) (U) BBLMSuffixMap BBLMLanguageSuffix *.todo BBLMLanguageSuffix .todo Language Features Comment Pattern String Pattern @w+s|+w+s Identifier and Keyword Character Class A-Za-z0-9_?!()
The code above is open source so feel free to use it at your own risk. If you are going to repost it else where, I hope that you would give credit to me.
The ToDoCodelessLanguageModule.plist should be saved to folder: ~/Library/Application Support/TextWrangler/Language Modules
- Priorities will be highlighted as blue
- Projects and contexts will be highlighted as red
- 2 types of comments: line comments starts with a # symbol; block comments are enclosed in /* … */
- A completed task will be highlighted the same colour as a comment
- To mark a task completed and ensure the highlighting was applied, you must follow the format: X YYYY-MM-DD (see screenshot at the beginning of this post for more details)
To test it, start a new file in TextWrangler and save it as a .todo file. For example:
Close the file then open it again, try to type “(A) Call Mom @Phone +Family”, the automatic highlighting should start as you type.
You can also verify it by checking that “To Do” appears on the language bar as a user defined language. For example: