Multi-line annotations on Taskwarrior

When I started using Taskwarrior, one of the first things that I missed was having plenty of space for writing my annotations.

Of course, I could add \n’s as I wished to break lines, but I wanted a comfier place to write them.

I quickly stumbled upon a simple script that could solve that. It worked like this: you run it with the task number and your preferred editor opened with a blank screen, ready for your annotation. Now when you saved and closed it, your task was annotated. Very useful.

I started to use that script, fixed some minor issues, added features, made it more robust… And you can find the result here.

Some features I added:

  • It accepts a filter instead of task ID, which may be convenient and more similar to Taskwarrior interface.
  • You can avoid opening the editor if you provide the annotation as an argument, as you would do with Taskwarrior.
  • It has some checks to avoid surprises and losing data. For example, if your filter doesn’t return any task, the editor won’t be started. If there is any error with adding your annotation, you won’t lose your text.
  • It enables syntax highlighting for markdown in VIM or any editor that checks for the file extension.
  • It distinguishes between multi-line and one-line annotations, adding a line break to the former.

My workflow is the following:

  • I have the script placed on PATH and I called it tan. This is an abbreviation for task annotate. I named this way to emulate my Taskwarrior aliases, which are tad for task add, te for task edit, etc. So tan for task annotate. This makes switching between my aliases and this script seamlessly.
  • Running tan <filter> This is an annotation will work as expected, as if you used Taskwarrior directly.
  • Running tan <filter> opens your editor (as defined in $EDITOR). You then are free to write your annotation with the size and break lines that you wish. When saving and exiting the editor, it will be appended to the task.

However, not everything is glory. This solves the adding of large annotations and they are shown correctly on task info. However, task edit can be a confusing view and I find manipulating them somewhat cumbersome.


All posts · Show comments