Introducing todotext.vim
By Tyler
Why
I recently made the switch to doing my text editing and programming in vim. I’ve been using vim like keybindings in VSCode for several years, and this last month I caught a desire to try just using vim (or neovim to be exact). This isn’t the first time I’ve tried to make the switch, but it seems to have finally taken.
One of the plugins that I really missed from VSCode was the TodoTree plugin. I had this configured as a quick way to view all the todo’s, fixme’s and bug notes littered throughout my code. I had integrated it as a simple way to keep track of tasks that needed to work on without pulling me out of what I was working on at the moment.
Without this tool I started looking for alternatives. While some plugins out there exist, none of them really struck me as scratching my itch. That is when I stumbled on todo.txt. Reading through the standard it met some of the key wants I had: First a standardized way of expressing todo items, Second it was simple, and easy to update, read and work with.
Of course me, being me, I came up with crazy and elaborate ideas of devloping a tool for parsing and displaying my todos to make it easy to edit and add them. Little did I know that vim was going to provide almost all the tooling needed to make my visions possible.
Syntax Highlighting
Vim comes out of the box with some powerful sytnax highliting capabilities, but even better, it allows you to define syntaxes for new filetypes. Doing so I was able to define a simple syntax file that will highlight priorities, dates, context and project tags in my todo.txt file.
Keybindings
Vim also allows a rich ability to define pretty much any keybindings that you like, and to do almost anything that you want. It also allows those keybindings to be scoped to only certain filetyeps. Using this ability I was able to define a simple keybinding to jump between lines in my todo.txt file of incompete tasks.
Additionally, I used tmux to configure a keybinding that allows me to quickly open my todo list anywhere. While I used tmux for this, you could easily set up a keybinding in vim to do this as well.
The results look a bit like this:
So What
This was a fun exercise for myself to better understand how vim works and how I can systematically add modifications for it, apart from simple vimrc additions. Additionally it was a lesson for me to “think-small”. Often I get excited and develop grand plans to create tools and software. More often then not those plans peter out into nothingness. However these change were so simple and easy I almost felt sad that I didn’t have to build a great big tool. If you are interested in using these changes for your own todo.txt files, the configuration is posted at github