问题
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 ?
回答1:
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
来源:https://stackoverflow.com/questions/11709965/vim-highlight-the-word-todo-for-every-filetype