Vim : Highlight the word TODO for every filetype

守給你的承諾、 提交于 2019-12-21 03:36:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!