My vim Based To-Do System

About a year ago, I came across this blog post by James Routley, where he explains his approach to keeping track of work-related notes. His "logbook" is a collection of Markdown files, stored in a single folder, and named according to the date they were created. This is implemented by writing a short function (called lb) in his .bashrc file which creates the markdown file for the day, which he can then write to.

The thing I love most about his approach is that the lb command can be run from anywhere on my machine and it will immediately pull up today's logbook. This makes it a super low-friction way to quickly note down ideas, store code snippets, or write down to-do lists.

The second thing I love is that after a short time doing this, I was able to generate a neat, organized set of markdown files of all the notes I took. Because the files are plaintext markdown, there is no risk of a company going defunct and losing my data, there is no walled-garden effect to make the data difficult to export, I don't have to deal with a laggy UI or feature bloat, and the files are fully greppable. By storing my logbook folder on Dropbox, I can make it so that my entire logbook is available on all my devices.

I find myself using this repository often to prepare for my 1-on-1s, and remind myself of commands and ideas that I used in the past but have since forgotten. I also use my logbook as a way to organize my thoughts throughout the day.

The command I have in my .zshrc file is slightly more complex than James's one, because it also creates the document with an in-file heading, and immediately jumps to the end of the file, so you can continue where you left off last time.

function lb() {
     if [ ! -f ~/Dropbox/Logbook/$(date '+%Y-%m-%d').md ]; then
        echo "Today's file doesn't exist, creating it"
        touch ~/Dropbox/Logbook/$(date '+%Y-%m-%d').md
        echo "Created the file"
        echo "# TECH NOTES FOR $(date '+%Y-%m-%d')\n\n" > ~/Dropbox/Logbook/$(date '+%Y-%m-%d').md
    fi
    vim "+normal G$" +startinsert ~/Dropbox/Logbook/$(date '+%Y-%m-%d').md
}

Creating my To Do Manager

I wanted to create a todo manager which had the same feel as James Routley's logbook. Most importantly, I wanted at least the following two features:

  • A command todo, which can be run from anywhere on my machine
  • A daily record of my todos, stored in plaintext markdown.

So I wrote a short Python script to do this. Now, when I type todo in my terminal for the first time, I am shown a screen very similar to this one:

Underneath each heading I can add any todo items I want to accomplish, editing the text file as I would edit any other text file. I can use any of -, *, [], [ ], or -> to denote a task, or [x] or [X] to denote a completed task.

If there is already a file from a previous day in the folder, then when I type todo, the file is parsed and I am asked about the status of each of the tasks that are relevant to me today. E.g. if I have a task which I intended to complete "this month", then I will only be asked about its status at the end of the month.

I can use one-letter commands to move a task to the correct time period. If I fail to complete a task today, I might choose to defer it to this week and thereby mark it as less urgent.

Since the files are all raw text files, I am free to edit each file as much as I like, provided that I follow the rough overall structure so that the Python script doesn't get confused.

You can try out the code yourself here, though be warned that this is very much still in an early stage of development and so may be very finicky.