Todo.txt TUI
Todo.txt TUI is a highly customizable terminal-based application for managing your todo tasks. It follows the todo.txt format and offers a wide range of configuration options to suit your needs.
Installation
crates.io
You can install the application directly from crates.io using the following command:
cargo install todotxt-tui
Manual Installation
-
Clone the repository.
-
Build the application using Rust's package manager, Cargo:
cargo build --release
Copy the executable from the target directory to a directory included in your system's PATH:
cp target/release/todotxt-tui /usr/local/bin/
Initial Setup
To set up the basic configuration, create a directory named todotxt-tui in your configuration folder (the default is $HOME/.config). Then, export the default configuration to this directory:
todotxt-tui --export-default-config "$HOME/.config/todotxt-tui/todotxt-tui.toml"
If todotxt-tui does not find the configuration folder, it will prompt you to create one.
Next, open the configuration file and set the todo_path to the path of your todo.txt file. Environment variables or ~ will be expanded if the path is in UTF-8 format.
Autocomplete
You can generate an autocomplete script for Bash and source it:
todotxt-tui --export-autocomplete ./autocomplete-todotxt-tui.sh
source ./autocomplete-todotxt-tui.sh
Alternatively, if you prefer on-the-fly autocompletion, you can add this to your .bashrc:
source <(todotxt-tui --export-autocomplete /dev/stdout)
Usage
Todo.txt TUI is a powerful and flexible terminal-based interface designed to simplify task management. Its customization options allow you to tailor the tool to fit your workflow. Below, you'll find a comprehensive list of keybindings and actions, organized by category, to help you get started. All actions can be customized in the configuration file to suit your preferences.
Keybindings
Navigation:
j: Move down to the next task in the list.k: Move up to the previous task in the list.g: Jump directly to the first task in the list.G: Jump directly to the last task in the list.
Managing Tasks:
Enter: Show task in preview.U: Move the currently selected task up in the list.D: Move the currently selected task down in the list.x: Remove the selected task permanently from the list.d: Toggle a task's status between pending and done.I: Input a new task into the list.E: Edit the currently selected task to update its details.
Widget Navigation:
J: Jump to the widget located below the current one.K: Jump to the widget located above the current one.H: Move to the widget on the left side of the current one.L: Move to the widget on the right side of the current one.
Filtering and Searching Tasks:
Backspace: Apply a filter to display specific categories in the pending or done lists./: Search for a keyword or phrase within the current list.n: Navigate to the next occurrence of the search term.N: Navigate to the previous occurrence of the search term.h: Clear the current search term and reset the list view.
File Operations:
S: Save all current tasks to the todo.txt file.u: Reload tasks from the todo.txt file to update the list with external changes.
Quit:
q: Quit Todo.txt TUI and save any unsaved changes.
Task Input Bar
The task input bar allows you to add or edit tasks. Press Enter to confirm the input and save the task, or press Esc to cancel. Additionally, common Bash/Emacs keybindings are supported:
Ctrl+w: Delete the previous word.Ctrl+e: Move the cursor to the end of the line.Ctrl+a: Move the cursor to the beginning of the line.Ctrl+k: Delete from the cursor to the end of the line.Ctrl+u: Delete from the cursor to the beginning of the line.
It is also possible to use tab key to autocomplete existing projects, contexts or hashtags.
Configuration
Todo.txt TUI provides extensive customization options through a TOML configuration file located in the todotxt-tui/todotxt-tui.toml directory. Configuration settings can be overridden using flags or environment variables, with the following priority order:
- Flags
- Environment variables
- Configuration file
For a complete list of available flags, use the help option (--help).
Configuration Folder Lookup
The application checks for the configuration folder in the following order:
$XDG_CONFIG_HOME- If
$XDG_CONFIG_HOMEis not set,$HOME/.configis used.
The default configuration folder can be changed using the --config-path <PATH> flag.
Relationship Between Flags, Environment Variables, and Configuration Keys
Flags, environment variables, and configuration keys share a consistent naming pattern:
- Flags use kebab-case (e.g.,
--pending-sort). - Environment variables are in uppercase, use underscores instead of hyphens, and are prefixed with
TODOTXT_TUI_(e.g.,$TODOTXT_TUI_PENDING_SORT). - Configuration keys use snake_case (e.g.,
pending_sort).
Value Consistency
Most values are interchangeable between flags, environment variables, and configuration keys. However, when using the configuration file, values should be written in PascalCase instead of kebab-case.
Example
For alphanumeric-reverse:
- Flag:
--alphanumeric-reverse - Environment variable:
$TODOTXT_TUI_ALPHANUMERIC_REVERSE - Configuration key (in the TOML file):
AlphanumericReverse
Keybindings
Keybindings follow a specific format and can be customized through configuration files or command-line arguments. Only events mentioned in their respective configuration sections are valid.
General Syntax
Keybindings are defined using the format:
"key_with_modifiers" = "Event"
<key with modifiers>: Defines the key combination for triggering the event.Event: Specifies the action that will be performed when the keybinding is triggered.
Key Rules
- Case Insensitivity: Keys are case-insensitive. For example,
jandJare equivalent, as areenterandEnter. - Non-Character Keys: Special keys like
enter,backspace, andescapemust be explicitly named. - Special Characters: The characters
+,,, and:have special meanings and must be named explicitly asplus,comma, anddoubledot, respectively.
Modifiers
Modifiers are optional and must be separated by a + symbol. Supported modifiers are:
shift(orS)alt(orA)ctrl(orC)
Modifiers can be written in full or abbreviated to their first letter. For example:
Shift+j=S+j=SHIFT+J
It is possible to use multiple modifiers in a single keybinding.
Examples
Basic Keybinding
j = "MoveDown"
Keybinding with Modifiers
"Shift+j" = "MoveDown"
"Ctrl+alt+k" = "MoveUp"
"Shift+Enter" = "Select"
Remapping Keybindings
When remapping keybindings, you must explicitly unmap the current binding using the None event. For example:
Example Remapping
To remap Shift+j = MoveDown to Down = MoveDown:
"Shift+j" = "None"
Down = "MoveDown"
If you do not unmap the original keybinding, both keybindings will trigger the same action.
Command-Line Configuration
Keybindings can also be configured via the command line using a compact syntax. Use the format:
[<binding1>:<event1>,<binding2>:<event2>,...]
Example
To set keybindings directly from the command line:
[S+j:MoveDown,S+k:MoveUp]
This syntax is equivalent to setting:
"Shift+j" = "MoveDown"
"Shift+k" = "MoveUp"
UI
-i, --init-widget$TODOTXT_TUI_INIT_WIDGETinit_widget- Possible values (flag, env):
list,done,project,context,hashtag,preview - Possible values (config):
List,Done,Project,Context,Hashtag,Preview - Default:
List
-t, --window-title$TODOTXT_TUI_WINDOW_TITLEwindow_title- Default:
ToDo TUI
-W, --window-keybinds$TODOTXT_TUI_WINDOW_KEYBINDSwindow_keybindsDefines the keybinds for window actions.
Default:
I = "InsertMode"
L = "MoveRight"
q = "Quit"
K = "MoveUp"
"/" = "SearchMode"
S = "Save"
u = "Load"
H = "MoveLeft"
J = "MoveDown"
E = "EditMode"
-R, --list-refresh-rate$TODOTXT_TUI_LIST_REFRESH_RATElist_refresh_rate- Default value: 5 seconds
- The configuration can also specify nanoseconds for finer granularity.
Configuration Example:
[list_refresh_rate]
secs = 5
nanos = 0
-S, --save-state-path$TODOTXT_TUI_SAVE_STATE_PATHsave_state_path-l, --layout$TODOTXT_TUI_LAYOUTlayoutList: The main list of tasks.Preview: The task preview section.Done: The list of completed tasks.Projects: The list of projects.Contexts: The list of contexts.Hashtags: The list of hashtags.
Here's an example of a custom layout configuration:
[
Direction: Horizontal,
Size: 50%,
[
List: 50%,
Preview,
],
[ Direction: Vertical,
Done,
[
Contexts,
Projects,
],
],
]
This example creates a layout with a horizontal split, where the list takes up 50% of the width, and the preview occupies the remaining space. On the right side, there's a vertical split with the list of completed tasks, contexts, and projects.
--paste-behavior$TODOTXT_TUI_PASTE_BEHAVIORpaste_behavior-
AsKeys: Simulates typing the pasted content as if entered via the keyboard. -
Insert: Directly inserts the pasted content at the cursor position. -
None: Disables pasting altogether. -
Default:
Insert
--enable-mouse$TODOTXT_TUI_ENABLE_MOUSEenable_mouse- Default:
true
To-do list
--use-done$TODOTXT_TUI_USE_DONEuse_done- Default:
false
--pending-sort$TODOTXT_TUI_PENDING_SORTpending_sort- Possible Values (Flag):
none,reverse,priority,alphanumeric,alphanumeric-reverse - Possible Values (Config):
None,Reverse,Priority,Alphanumeric,AlphanumericReverse - Default:
None
Sorting Options:
- None: No specific sorting; tasks appear in the order they were added.
- Reverse: Reverse the order of tasks.
- Priority: Sort tasks by priority.
- Alphanumeric: Sort tasks in alphanumeric order.
- AlphanumericReverse: Sort tasks in reverse alphanumeric order.
--done-sort$TODOTXT_TUI_DONE_SORTdone_sort- Possible Values (Flag):
none,reverse,priority,alphanumeric,alphanumeric-reverse - Possible Values (Config):
None,Reverse,Priority,Alphanumeric,AlphanumericReverse - Default:
None
--delete-final-date$TODOTXT_TUI_DELETE_FINAL_DATEdelete_final_date- Default:
true
--set-final-date$TODOTXT_TUI_SET_FINAL_DATEset_final_date- Possible Values (Flag):
override,only-missing,never - Possible Values (Config):
Override,OnlyMissing,Never - Default:
OnlyMissing
Final Date Options:
- Override: Set the final date every time a task is marked as completed.
- OnlyMissing: Set the final date only if it is not already set.
- Never: Never set the final date.
--set-created-date$TODOTXT_TUI_SET_CREATED_DATEset_created_date- Default:
true
File worker
--todo-path$TODOTXT_TUI_TODO_PATHtodo_pathdefault: $HOME/todo.txt
--archive-path$TODOTXT_TUI_ARCHIVE_PATHarchive_path-d, --autosave-duration$TODOTXT_TUI_AUTOSAVE_DURATIONautosave_durationdefault: 900
-f, --file-watcher$TODOTXT_TUI_INIT_WIDGETfile_watcherdefault: true
-i, --save-policy$TODOTXT_TUI_SAVE_POLICYsave_policyManualOnly: Requires explicit user action to save changes.AutoSave: Automatically saves changes at intervals defined by `autosave_duration.OnChange: Saves changes immediately whenever modifications occur.
default: OnChange
Widget
-T, --tasks-keybind$TODOTXT_TUI_TASKS_KEYBINDtasks_keybindDefines the keybindings used for interacting with task items within the application. These bindings allow you to quickly navigate, edit, and perform actions on tasks.
default:
d = "MoveItem"
x = "RemoveItem"
D = "SwapDownItem"
n = "NextSearch"
U = "SwapUpItem"
Enter = "Select"
N = "PrevSearch"
-C, --category-keybind$TODOTXT_TUI_CATEGORY_KEYBINDcategory_keybindSpecifies the keybindings for managing and navigating categories such as projects and contexts. These categories help you organize tasks effectively.
default:
Enter = "Select"
n = "NextSearch"
N = "PrevSearch"
Backspace = "Remove"
-i, --border-type$TODOTXT_TUI_BORDER_TYPEborder_typepossible values (flag, env): plain, rounded, double, thick
possible values (conf): Plain, Rounded, Double, Thick
default: Rounded
List
-s, --list-shift$TODOTXT_TUI_LIST_SHIFTlist_shiftdefault: 4
-L, --list-keybind$TODOTXT_TUI_LIST_KEYBINDlist_keybindConfigures the keybindings for interacting with task lists. These bindings enable efficient scrolling, selection, and manipulation of list items.
default:
G = "ListLast"
h = "CleanSearch"
k = "ListUp"
g = "ListFirst"
j = "ListDown"
--pending-format$TODOTXT_TUI_PENDING_FORMATpending_formatThe format string used to render pending tasks in the list. Format is same as for preview.
default: [$subject](! priority)
--done-format$TODOTXT_TUI_DONE_FORMATdone_formatThe format string used to render completed tasks in the list. Format is same as for preview.
default: [$subject](! priority)
Preview
Defines the format string used to generate the preview pane, which provides a detailed view of the selected task. You can use placeholders to include dynamic content based on task attributes and apply text styling with the new format syntax.
Formatting Rules
Text Colors: Enclose text in [...] and specify the style in parentheses. As style you can use any color definition from Colors. Additionally, you can use skip_projects, skip_contexts, or skip_hashtags to remove projects, contexts, or hashtags from the content.
Examples:
[some text](Red)sets the text to have a red foreground.[some text](^Red)sets the text to have a red background.[some text](Blue, Bold)sets the text to have a bold, blue foreground.[some text +project](Green, skip_projects)sets the text to have a green foreground and removes+projectfrom it.
Dynamic Variables: Insert task-specific values using $name. You can use the following variables to represent task attributes:
| Variable | Description |
|---|---|
| $pending | The number of pending tasks. |
| $done | The number of completed tasks. |
| $subject | The subject of the task. |
| $priority | The task's priority. If used as priority:A, it specifies a particular priority. If omitted, it uses the task's default priority. |
| $custom_category | The task's custom category. If used as custom_category:+project, it specifies a particular custom category. If omitted, it uses the task's default custom category. |
| $create_date | The creation date of the task. |
| $finish_date | The finish date of the task. |
| $finished | Indicates whether the task is finished (true or false). |
| $threshold_date | The threshold date of the task. |
| $due_date | The due date of the task. |
| $contexts | The contexts associated with the task. |
| $projects | The projects associated with the task. |
| $hashtags | The hashtags associated with the task. |
| other | Special values for custom key-value pairs in the todo.txt format. |
It is also possible to use ! to enforce category colors.
Example format string:
[Pending: $pending](#ff0000) [Done: $done](^Green)
[Subject: $subject](! priority)
[Priority: $priority](priority:A)
[Created: $create_date](^Yellow)
[Link: $link](^9)
This example configures the preview pane with styled text for pending and completed tasks, task details, and dynamic values based on attributes.
Options
-p, --preview-format$TODOTXT_TUI_PREVIEW_FORMATpreview_formatDefines the format string used to generate the preview pane, which provides a detailed view of the selected task. Placeholders allow dynamic content customization based on task attributes. Format description is above.
default:
Pending: $pending Done: $done
Subject: $subject
Priority: $priority
Create date: $create_date
Link: $link"""
-w, --wrap-preview$TODOTXT_TUI_INIT_WIDGETwrap_previewdefault: true
Colors
In Todo.txt TUI, you can customize the colors and text styles for various elements to suit your preferences. The customization options include setting foreground (fg) and background (bg) colors, as well as applying text modifiers to style the text.
Defining Colors
You can specify colors in the following formats:
- Named Colors: Use standard color names, e.g.,
"Black","Red", etc. - RGB Values: Use hexadecimal codes, e.g.,
"#ff0000"for red. - Terminal Index: Use terminal color indices, e.g.,
"9"for bright red.
Applying Text Modifiers
Modifiers allow you to style text with additional visual effects. Available modifiers include:
Bold: Makes the text bold.Italic: Applies italic styling.Underlined: Underlines the text.
Example Configuration
To configure custom colors and text modifiers for the project +todo-tui, update your Todo.txt TUI application's TOML configuration file as follows:
[custom_category_style."+todo-tui"]
fg = "#ff0000" # Set foreground color to red (RGB value)
bg = "Black" # Set background color to black (named color)
modifiers = "Italic" # Apply italic styling
This configuration will style the text for +todo-tui with a red foreground, black background, and italicized text.
Options
-A, --list-active-color$TODOTXT_TUI_LIST_ACTIVE_COLORlist_active_colordefault:
bg = "LightRed"
-P, --pending-active-color$TODOTXT_TUI_PENDING_ACTIVE_COLORpending_active_color-D, --done-active-color$TODOTXT_TUI_DONE_ACTIVE_COLORdone_active_color--category-active-color$TODOTXT_TUI_CATEGORY_ACTIVE_COLORcategory_active_color--projects-active-color$TODOTXT_TUI_PROJECTS_ACTIVE_COLORprojects_active_color--contexts-active-color$TODOTXT_TUI_CONTEXTS_ACTIVE_COLORcontexts_active_color--tags-active-color$TODOTXT_TUI_TAGS_ACTIVE_COLORtags_active_colorStyles
--active-color$TODOTXT_TUI_ACTIVE_COLORactive_colordefault: Red
--priority-style$TODOTXT_TUI_PRIORITY_STYLEpriority_styledefault:
A.fg = "Red"
B.fg = "Yellow"
C.fg = "Blue"
--projects-style$TODOTXT_TUI_PROJECTS_STYLEprojects_style--contexts-style$TODOTXT_TUI_CONTEXTS_STYLEcontexts_style--hashtags-style$TODOTXT_TUI_HASHTAGS_STYLEhashtags_style--category-style$TODOTXT_TUI_CATEGORY_STYLEcategory_style--category-select-style$TODOTXT_TUI_CATEGORY_SELECT_STYLEcategory_select_styledefault:
fg = "Green"
--category-remove-style$TODOTXT_TUI_CATEGORY_REMOVE_STYLEcategory_remove_styledefault:
fg = "Red"
--custom-category-style$TODOTXT_TUI_CUSTOM_CATEGORY_STYLEcustom_category_styledefault:
"+todo-tui".fg = "LightBlue"
--highlight$TODOTXT_TUI_HIGHLIGHThighlightdefault:
bg = "Yellow"
Hooks
--pre-new-task$TODOTXT_TUI_PRE_NEW_TASKpre_new_task--post-new-task$TODOTXT_TUI_POST_NEW_TASKpost_new_task--pre-remove-task$TODOTXT_TUI_PRE_REMOVE_TASKpre_remove_task--post-remove-task$TODOTXT_TUI_POST_REMOVE_TASKpost_remove_task--pre-move-task$TODOTXT_TUI_PRE_MOVE_TASKpre_move_task--post-move-task$TODOTXT_TUI_POST_MOVE_TASKpost_move_task--pre-update-task$TODOTXT_TUI_PRE_UPDATE_TASKpre_update_task--post-update-task$TODOTXT_TUI_POST_UPDATE_TASKpost_update_task