Skip to content
Brett Terpstra edited this page Mar 17, 2022 · 6 revisions

You can optionally define keywords for common tasks and projects in your .doingrc file. Keywords in your entries can trigger automatic tagging, just to make life easier. There are four tools available: default tags, whitelisting, synonym tagging, and tag transformation.

Default tags are tags that are applied to every entry. You probably don't want to add these in the root configuration, but using a local .doingrc in a project directory that defines default tags for that project allows anything added from that directory to be tagged automatically. A local .doingrc in my Marked development directory might contain:

---
default_tags: [marked,coding]

And anything I enter while in the directory gets tagged with @marked and @coding.

You can easily add default tags to the current directory by running doing tag_dir TAG. This will offer to create a .doingrc file at your current location, and all entries created within that directory (or subdirectories) will be tagged with the tag(s) you specify. Multiple arguments allowed, and the value will always overwrite the current setting. Use doing tag_dir -r to clear the default tags.

A whitelist is a list of words that should be converted directly into @tags. If my whitelist contains "design" and I type doing now working on site design, that's automatically converted to "working on site @design." The array of trigger words for each white list tag can include ? and * wildcards.

Synonyms allow you to define keywords that will trigger their parent tag. If I have a tag called @design, I can add "typography" as a synonym. Then entering doing now working on site typography will become "working on site typography @design."

White lists and synonyms are defined like this:

autotag:
  synonyms:
    design:
    - typography
    - layout
    brainstorming
    - think*
    - idea*
  whitelist:
  - brainstorming
  - coding

YAML note: When defining synonym keys, be sure to indent but not hyphenate the parent keys (design and brainstorm above), while hyphenating the list of synonyms at the same indent level as the parent key.

Note that you can include a tag with synonyms in the whitelist as well to tag it directly when used.

Auto tagging (adding tags listed in .doingrc under autotag and default_tags) can be skipped for an entry with the -x global option, e.g. doing -x done skipping some automatic tagging, or by using -X at the end of the command (for when you realize you want to skip it after typing the whole thing out 😅).

Tag transformation

You can include a transform section in the autotag config which contains pairs of regular expressions which match a tag and replacement patterns separated by a colon. These will be used to look at existing tags in the text and generate additional tags from them. For example:

autotag:
  transform:
  - "(\\w+)-\\d+:$1"

Note that backslashes need to be doubled, and the entire expression should be surrounded in double quotes. If your pattern needs to include a :, then use :: to split the pattern and replacement, e.g. tag1:(d.*?)::tag1 tag1-$1

This creates a search pattern looking for a string of word characters followed by a hyphen and one or more digits, e.g. @projecttag-12. Do not include the @ symbol in the pattern. The replacement ($1) indicates that the first matched group (in parenthesis) should be used to generate the new tag, resulting in @projecttag being added to the entry.

You can convert a tag into multiple tags by separating the new tags with a space in the replacement, e.g. project1:work project. Now Tackling @project1 becomes tackling @project1 @work @project.

Transformed tags are added at the end of the title. If you want the transformation to happen in place, replacing the matched tag, add /r at the end of the replacement, e.g. whistling:work topsecret/r. Now walking away @whistling becomes walking away @work @topsecret.