Reputation: 18553
Starting with vim and love that it highlights todo comments. Around here, however we use a custom keyword (first initial last initial todo: abTODO) so it's easy to grep for todos that apply to a specific person.
I'd love to add mine as a keyword that vi picks up and highlights along with todo, fixme and xxx.
In vim, how do I highlight TODO: and FIXME:? seems to apply, but using the following does not work:
syn match myTodo contained "abTODO"
hi def link myTodo Todo
UPDATE
In my .vimrc I have the following 3 lines (as suggested):
syntax enable
syn match myTodo "\<\l\{2\}TODO\>"
hi def link myTodo Todo
That is a lowercase L, not 1. However abTODO is still not being highlighted at all.
Upvotes: 4
Views: 2796
Reputation: 15735
Try this match:
syn match myTodo "\<\l\{2\}TODO\>"
Explanation:
\<
matches the beginning of a word\l\{2\}
matches precisely two lowercase lettersTODO\>
matches the string TODO
at the end of the wordYour highlight command is fine at it is. I don't think the contained
option is necessary here.
Upvotes: 3