Last Updated: February 25, 2016
·
4.431K
· veselosky

vim to-do list

Do you leave TODO or FIXME comments in your code? Here's how you can automatically generate a to-do list in Vim. Add this to your vimrc:

command Todo noautocmd vimgrep /TODO\|FIXME/j ** | cw

The "Todo" command will find all the occurrences of such comments not just in the current file, but recursively in all subdirectories of the current directory. It will assemble them all into the Quickfix list, then open the Quickfix list window for navigation. Hit enter on a TODO item to open the file and go to that line.

If you use the ack-vim plugin, you can simplify to:

command Todo Ack! 'TODO\|FIXME'

This gives you the added bonus of only searching files that contain source code, rather than every file found.

vimgrep: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:vimgrep
Vim Quickfix list: http://vimdoc.sourceforge.net/htmldoc/quickfix.html
ack-vim plugin: http://www.vim.org/scripts/script.php?script_id=2572

1 Response
Add your response

Ags version with optional autocomplete paths so you don't have to search whole project

command -nargs=? -complete=file Todo execute "Ags" 'TODO\|FIXME\|XXX' <f-args>
over 1 year ago ·