Here are two scenarios which make this feature useful:
If we put TODOs among the attention-needed code, it would be great that Vim gives some popups or warnings when it opens a file with these TODOs. I am quite a novice on Vim. Could anyone give some help? Thank you!
You could listen for the event BufReadPost
where you should search()
for "TODO", and there generate a message. Either with :echomsg
or :call confirm()
, if you're using gvim.
" untested
aug notify_TODO
au!
au BufReadPost * if search('TODO') > 0 | call confirm('Need to fix this', '&OK', 1, "warning") | endif
aug END
You could also populate the quickfix list with all occurrences of "TODO".
:call setqflist(filter(map(getline(1,'$'), '{"bufnr": '.bufnr("%").', "lnum": v:val =~ "TODO" ? v:key : -1, "text": v:val}'), 'v:val.lnum>0'))
:copen
(best put in a function)
Or simply check for TODO in every, or specific, files with :vimgrep
.