summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.chezmoi.toml.tmpl3
-rw-r--r--dot_local/bin/executable_todosort.py26
-rw-r--r--dot_todo.cfg.tmpl15
3 files changed, 44 insertions, 0 deletions
diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl
index 7c1864f..16c95bb 100644
--- a/.chezmoi.toml.tmpl
+++ b/.chezmoi.toml.tmpl
@@ -13,3 +13,6 @@
     name = {{ promptString "git name" $defaultName | quote }}
     email = {{ promptString "git email" $defaultEmail | quote }}
     pager = {{ promptString "git pager" $defaultPager | quote }}
+
+[data.todo]
+    personalPriority = {{ promptString "personal todo.txt priority words" $defaultUsername | quote }}
diff --git a/dot_local/bin/executable_todosort.py b/dot_local/bin/executable_todosort.py
new file mode 100644
index 0000000..2f75ee9
--- /dev/null
+++ b/dot_local/bin/executable_todosort.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+
+import sys
+
+
+def main() -> None:
+    priority_words = {w.lower() for w in sys.argv[1:]}
+    lines = []
+    for line in sys.stdin.readlines():
+        words = line.split()
+        if words[1].startswith('(') and words[1].endswith(')'):
+            priority = words[1]
+        else:
+            priority = '(X)'
+        for due in words:
+            if due.startswith('due:'):
+                break
+        else:
+            due = 'due:3000-01-01'
+        has_priority_words = not any(w.lstrip('+#@').lower() in priority_words for w in words)
+        lines.append((priority, has_priority_words, due, line))
+    print(''.join(l for *_, l in sorted(lines)))
+
+
+if __name__ == '__main__':
+    main()
diff --git a/dot_todo.cfg.tmpl b/dot_todo.cfg.tmpl
new file mode 100644
index 0000000..2b5125c
--- /dev/null
+++ b/dot_todo.cfg.tmpl
@@ -0,0 +1,15 @@
+export TODO_DIR="${HOME}/.local/share/todo"
+export TODO_FILE="${TODO_DIR}/todo.txt"
+export DONE_FILE="${TODO_DIR}/done.txt"
+export REPORT_FILE="${TODO_DIR}/report.txt"
+export TODO_ACTIONS_DIR="$HOME/.config/todo.actions.d"
+export PRI_A=${YELLOW}
+export PRI_B=${GREEN}
+export PRI_C=${LIGHT_BLUE}
+export COLOR_DONE=${LIGHT_GREY}
+export COLOR_PROJECT=${RED}
+export COLOR_CONTEXT=${RED}
+export COLOR_DATE=${BLUE}
+export COLOR_NUMBER=${GRAY}
+export COLOR_META=${CYAN}
+export TODOTXT_SORT_COMMAND='todosort.py {{ .todo.personalPriority }}'