created December 19, 2002 · complexity basic · author Sean · version 6.0
I use this to maintain a TODO list for projects I am working on. All my projects are pretty small scale with each project stored in it's own directory so this tip was writtten with that in mind. Basically it is two keymappings one which inserts
leaving Vim in insert mode so you can add a note to help you remember what you wanted to do.
The other mapping uses :grep to search for all occurrences of TODO_ITEM in files in the current directory excluding ~ files and then opens the error window displaying the list of TODO_ITEMs.
imap \q <ESC>i//TODO_ITEM<SPACE> map \q i//TODO_ITEM<SPACE> imap \w <ESC>:grep --exclude=*~ TODO_ITEM * <CR> :copen <CR> map \w :grep --exclude=*~ TODO_ITEM * <CR> :copen <CR>
Change the comment style to suit your language and the lame keymappings to something better.
I develop in the same fashion (one project per directory) and developed a program to do exactly this, called devtodo (http://devtodo.sf.net).
Be sure to have 'grepprg=grep -n', because vim needs the line numbers.
You can do this 'quickfix' search for any word under the cursor:
" grep for word under cursor in c/cpp/h-files map <F9> <ESC>:exec("grep ".expand("<cword>")." ../*/*.c* ../*/*.h")<CR> "same as menu entry: 22amenu Search.Grep\ for\ word\ under\ cursor <ESC>:exec("grep ".expand("<cword>")." ../*/*.c* ../*/*.h")<CR>