• 14
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Manage #TODO (lots of files) with VIM

I use VIM/GVIM to develop my python projects and I randomly I leave #TODO comments in my code.

Is there any way to manage (search, list and link) all the #TODO occurrences inside VIM? I tried the tasklist plugin, it's almost what I need, but it only lists the current file #TODO occurrences. Generally my projects has some sub-folders and many .py files, so I'd like to find a way to search through all folders and files in the current working directory and list them.

    • Thanks for the advice, but I think that an editor switch is out of question in moment (I'm in love with VIM). Sorry but I strongly think that switching to an issue tracker just to take a note like "write an exception for this later" or "add this in the unittest" is an waste of time. And I'll take a look at emacs, I swear :).
      • 1
    • @aaronasterling: If you're so eager to proselytize for emacs, why are you reading and commenting on vim questions? (I don't think that sort of comment is obligatory at all.)
      • 2
    • @jefromi, I generally read everything with a python tag. I didn't notice vim in the title. The proselytizing was mainly a joke: I primarily wanted to say "Use an issue tracker" which is what the only person that answered ended saying as well.

If you just want a list of the occurences of "TODO" in .py files in the working directory, you can just use :vimgrep like so:

:vimgrep TODO **/*.py

Then open the quickfix window with:

:cw

(it might open it automatically anyway, not sure) and just scroll through the results, hitting Enter to go to each occurrence.

For more complicated management, I'd probably recommend setting up an issue tracker.

  • 49
Reply Report
      • 2
    • Faster is :noautocmd vimgrep /TODO/ **/*.py which will not trigger any autocmd while loading files for looking inside them.
    • Thats amazing, almost perfect! The only inconvenience it that my cursor jumps to the first occurrence. But I can live with it!
      • 1
    • @Benoit, thats a great tip! I'll use it in my keymapping. noremap t :noautocmd vimgrep /TODO/ **/*.py
    • @Magnun Leno Looking at the docs, I see you can use the j flag to make it not jump to the first occurrence: :vimgrep /TODO/j **/*.py
      • 1
    • @Luquid_Fire, Thats simply amazing! Thanks a lot, it's perfect now! noremap t :noautocmd vimgrep /TODO/j **/*.py:cw. VIM rocks!

Trending Tags