25
Jul

Vim and Todo.txt

Posted on July 25, 2011 by justin

Since I started writing code in Python, I've been a big fan of vim. Sure, at first it was a bizarre alien creature, but over time I've learnt it's quirks, and gotten quite comfortable.

Recently, I've thrown Todo.txt into the mix - flat text file, can sync it between my various workstations with dropbox, and I can use Punch to track my time. Plus they have an excellent android app out.

I'm trying to improve my work flow - I want to be able to tag a line in a file as being something to come back to (say I spot a minor bug or some such, while working on a different part of a project - I don't want to interrupt my workflow, and I don't want to rely on my memory), and I want that to go into my tasks list. So I've come up with the following to add to my .vimrc:

map t :exe "silent !todo.sh add " . shellescape(input("Enter todo item: "),1) . " " . shellescape(expand("%:p"), 1) . ":" . line(".")<CR>

Simply hit t, type in the task (eg. Need to document this function, or Need to add unit test for this), and then hit enter. Then keep on as you were before the interuption. It looks rather monstrous, but it does what I need it to do. :)

Of course, you could even automatically add a project or context to todo items added this way:

map t :exe "silent !todo.sh add " . shellescape(input("Enter todo item: "),1) . " @mycontext " . shellescape(expand("%:p"), 1) . ":" . line(".")<CR>

Comments

0 comments have been posted.

Post a comment