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.
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_HOME
is not set,$HOME/.config
is 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
UI
-i
, --init-widget
$TODOTXT_TUI_INIT_WIDGET
init_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_TITLE
window_title
- Default:
ToDo TUI
-W
, --window-keybinds
$TODOTXT_TUI_WINDOW_KEYBINDS
window_keybinds
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_RATE
list_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_PATH
save_state_path
-l
, --layout
$TODOTXT_TUI_LAYOUT
layout
List
: 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.
To-do list
--use-done
$TODOTXT_TUI_USE_DONE
use_done
- Default:
false
--pending-sort
$TODOTXT_TUI_PENDING_SORT
pending_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_SORT
done_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_DATE
delete_final_date
- Default:
true
--set-final-date
$TODOTXT_TUI_SET_FINAL_DATE
set_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.
File worker
--todo-path
$TODOTXT_TUI_TODO_PATH
todo_path
default: $HOME/todo.txt
--archive-path
$TODOTXT_TUI_ARCHIVE_PATH
archive_path
-d
, --autosave-duration
$TODOTXT_TUI_AUTOSAVE_DURATION
autosave_duration
default: 900
-f
, --file-watcher
$TODOTXT_TUI_INIT_WIDGET
file_watcher
default: true
-i
, --save-policy
$TODOTXT_TUI_SAVE_POLICY
save_policy
ManualOnly
: 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_KEYBIND
tasks_keybind
default:
d = "MoveItem"
x = "RemoveItem"
D = "SwapDownItem"
n = "NextSearch"
U = "SwapUpItem"
Enter = "Select"
N = "PrevSearch"
-C
, --category-keybind
$TODOTXT_TUI_CATEGORY_KEYBIND
category_keybind
default:
Enter = "Select"
n = "NextSearch"
N = "PrevSearch"
Backspace = "Remove"
-i
, --border-type
$TODOTXT_TUI_BORDER_TYPE
border_type
possible values (flag, env): plain
, rounded
, double
, thick
possible values (conf): Plain
, Rounded
, Double
, Thick
default: Rounded
List
-s
, --list-shift
$TODOTXT_TUI_LIST_SHIFT
list_shift
default: 4
-L
, --list-keybind
$TODOTXT_TUI_LIST_KEYBIND
list_keybind
default:
G = "ListLast"
h = "CleanSearch"
k = "ListUp"
g = "ListFirst"
j = "ListDown"
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
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.
Dynamic Variables: Insert task-specific values using $name. You can use the following variables to represent task attributes:
Variable | Description |
---|---|
$pending | Number of pending tasks. |
$done | Number of completed tasks. |
$subject | Task subject. |
$priority | Task priority. |
$create_date | Task creation date. |
$finish_date | Task finish date. |
$finished | Task finished status (true or false). |
$threshold_date | Task threshold date. |
$due_date | Task due date. |
$contexts | Task contexts. |
$projects | Task projects. |
$hashtags | Task hashtags. |
other | Special values for custom key-value pairs in the todo.txt format |
Example format string:
[Pending: $pending](#ff0000) [Done: $done](^Green)
[Subject: $subject](Blue Bold)
[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_FORMAT
preview_format
Defines 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_WIDGET
wrap_preview
default: 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_COLOR
list_active_color
default:
bg = "LightRed"
-P
, --pending-active-color
$TODOTXT_TUI_PENDING_ACTIVE_COLOR
pending_active_color
-D
, --done-active-color
$TODOTXT_TUI_DONE_ACTIVE_COLOR
done_active_color
--category-active-color
$TODOTXT_TUI_CATEGORY_ACTIVE_COLOR
category_active_color
--projects-active-color
$TODOTXT_TUI_PROJECTS_ACTIVE_COLOR
projects_active_color
--contexts-active-color
$TODOTXT_TUI_CONTEXTS_ACTIVE_COLOR
contexts_active_color
--tags-active-color
$TODOTXT_TUI_TAGS_ACTIVE_COLOR
tags_active_color
Styles
--active-color
$TODOTXT_TUI_ACTIVE_COLOR
active_color
default: Red
--priority-style
$TODOTXT_TUI_PRIORITY_STYLE
priority_style
default:
A.fg = "Red"
B.fg = "Yellow"
C.fg = "Blue"
--projects-style
$TODOTXT_TUI_PROJECTS_STYLE
projects_style
--contexts-style
$TODOTXT_TUI_CONTEXTS_STYLE
contexts_style
--hashtags-style
$TODOTXT_TUI_HASHTAGS_STYLE
hashtags_style
--category-style
$TODOTXT_TUI_CATEGORY_STYLE
category_style
--category-select-style
$TODOTXT_TUI_CATEGORY_SELECT_STYLE
category_select_style
default:
fg = "Green"
--category-remove-style
$TODOTXT_TUI_CATEGORY_REMOVE_STYLE
category_remove_style
default:
fg = "Red"
--custom-category-style
$TODOTXT_TUI_CUSTOM_CATEGORY_STYLE
custom_category_style
default:
"+todo-tui".fg = "LightBlue"
--highlight
$TODOTXT_TUI_HIGHLIGHT
highlight
default:
bg = "Yellow"
Hooks
--pre-new-task
$TODOTXT_TUI_PRE_NEW_TASK
pre_new_task
--post-new-task
$TODOTXT_TUI_POST_NEW_TASK
post_new_task
--pre-remove-task
$TODOTXT_TUI_PRE_REMOVE_TASK
pre_remove_task
--post-remove-task
$TODOTXT_TUI_POST_REMOVE_TASK
post_remove_task
--pre-move-task
$TODOTXT_TUI_PRE_MOVE_TASK
pre_move_task
--post-move-task
$TODOTXT_TUI_POST_MOVE_TASK
post_move_task
--pre-update-task
$TODOTXT_TUI_PRE_UPDATE_TASK
pre_update_task
--post-update-task
$TODOTXT_TUI_POST_UPDATE_TASK
post_update_task