Skip to content
Brett Terpstra edited this page Mar 20, 2022 · 4 revisions

You can create your own "views" in the ~/.doingrc file and view them with doing view view_name. Just add a section like this:

views:
  old:
    section: Archive
    count: 5
    wrap_width: 0
    date_format: '%F %_I:%M%P'
    template: '%date | %title%note'
    order: asc
    tags: done finished cancelled
    tags_bool: ANY
    only_timed: false
    tag_sort: time
    tag_order: asc
    totals: true

You can add additional custom views. Just nest them under the views key (indented two spaces from the edge). Multiple views would look like this:

views:
  later:
    title: Stuff to do later
    section: Later
    count: 5
    wrap_width: 60
    date_format: '%F %_I:%M%P'
    template: '%date | %title%note'
  old:
    section: Old
    count: 5
    wrap_width: 0
    date_format: '%F %_I:%M%P'
    template: '%date | %title%note'

The title key is optional, it only affects output options like HTML where there's a page title shown. If it's missing, the title will be generated from an appropriate combination of section or tag filters.

The section key is the default section to pull entries from. Count and section can be overridden at runtime with the -c and -s flags. Setting section to All will combine all sections in the output.

You can add new sections with doing add_section section_name. You can also create them on the fly by using the -s section_name flag when running doing now. For example, doing now -s Misc just a random side note would create the "just a random side note" entry in a new section called "Misc," if Misc didn't already exist.

The tags and tags_bool keys allow you to specify tags that the view is filtered by. You can list multiple tags separated by spaces, and then use tags_bool to specify ALL, ANY, or NONE to determine how it handles the multiple tags.

The order key defines the sort order of the output (asc or desc). This is applied after the tasks are retrieved and cut off at the maximum number specified in count.

You can include tag timers and totals in the output with totals: true. Control tag output using tag_sort (name or title) and tag_order (asc or desc). You can also output only timed entries using only_timed: true. All of these options can be overridden using flags on the doing view command.

View templates specified by the templates key follow the same rules as Templates. Regarding colors, you can use them to create very nice displays if you're outputting to a color terminal. Example:

color:
  date_format: '%F %_I:%M%P'
  section: Currently
  count: 10
  wrap_width: 0
  template: '%boldblack%date %boldgreen| %boldwhite%title%default%note'

Outputs:

Use doing colors to see all available template colors.

You can also specify a default output format for a view with the output_format key. Most of the output format options override the template specification (html, csv, json, markdown). If the view command is used with the -o flag, it will override what's specified for the view in the config.

Experimental (and underdeveloped) feature: specify a relative date range to show in the view with the from key. This can be days, times, or both. To create a view that shows you what you did during work week, use:

views:
  workweek:
    from: monday to friday

Inheritance

All views inherit the base configuration of templates.default. Any keys not defined in the view will be filled in with default values.

You can specify a parent key in a view with the name of another view to inherit any missing keys from that view. The keys defined in the child view will always override existing keys in the parent view.

Saving Display Options

All display commands have a --save=NAME flag which will generate a view config when run. All options specified on that command line are converted into view config keys and added to your main config file as a view titled with the value of NAME.

Views as Commands

If you run doing with an unrecognized command and no additional arguments, it will search your views for a matching title. This allows views to function as custom commands. If you save a view called "custom," you can then just run doing custom to execute the view (as if you'd run doing view custom). You can include additional options and flags with the command to override the view settings.

If there are more than one arguments and the command isn't recognized as a view (or a built-in command), the arguments will be passed to doing now and added as a new entry.