Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim : Highlight the word TODO for every filetype

I would like to highlight the word TODO in vim, no matter what file is edited (code or normal text). It currently works for many different languages (for example, TODO is highlighted in C/Java comments by default), but I use vim for non-code text files and I would like to see the TODOs highlighted for them too.

What is the easiest way to do that ?

like image 665
user1536048 Avatar asked Jul 29 '12 14:07

user1536048


1 Answers

Highlighting TODO for every filetype and without possibly breaking other syntax rules can be done only by using :match/matchadd():

augroup HiglightTODO
    autocmd!
    autocmd WinEnter,VimEnter * :silent! call matchadd('Todo', 'TODO', -1)
augroup END
like image 87
ZyX Avatar answered Sep 18 '22 18:09

ZyX