Multi-line annotations on Taskwarrior
Aug 04, 2021
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 opens with a blank screen, ready for your annotation. Now when you save and close it, your task is annotated. Very useful.
I started to use that script, fixed some minor issues, added features, made it more robust… 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 the 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 data loss. For example, if your filter doesn’t return any task, the editor won’t be started. If there is any error when adding your annotation, you won’t lose your text.
- It enables syntax highlighting for markdown in VIM or any editor that checks 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 name ittan
. This is an abbreviation fortask annotate
. I named this way to emulate my Taskwarrior aliases, which aretad
fortask add
,te
fortask edit
, etc. Sotan
fortask annotate
. This makes switching between my aliases and this script seamless. - 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 issue of adding large annotations and they are displayed correctly in task info
. However, task edit
can be a confusing view and I find manipulating them somewhat cumbersome.
Have comments? E-mail me.