HACK HACK BODGE
Following on from a conversation at the Pisa-London.pm Social last night about vim syntax highlighting useful words in perl files like TODO and how it might also be useful to highlight other useful words, like HACK and BODGE, I decided to have a go.
I knew the initial solution would be fairly simple - hack
That seemed to easy, so I investigated a
Initially I copied the existing
perl.vim into my local directory:
cp /usr/share/vim/vim72/syntax/perl.vim $HOME/.vim/syntax/
perlTodo line to include the new tokens.
I opened my test file and it worked!
I’ve had a long-standing urge to handle tokens followed by an evil colon. I prefer:
# TODO: something shiny
# TODO something shiny
To me it looks nicer when it isn’t highlighted.
I further modified the
perlTodo line, from
match and included my friend, the colon.
:e!” later and … it worked!
I really didn’t want a copy of the entire
perl.vim syntax file.
I took a risk and edited my local copy down to one single line, reloaded my test file and … it did the right thing!
To go from:
$HOME/.vim/syntax/perl.vim and add the following line:
syn match perlTodo "\<\(TODO\|TBD\|FIXME\|XXX\|HACK\|BODGE\)\:\?\>" contained