1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# todotxt.nvim
Neovim plugin to view and add tasks stored in a todo.txt format.
[![asciicast](doc/asciinema.png)](https://asciinema.org/a/DVMyXY3pvUBKNdzu5Ywy9jweE)
## Features
### Sidebar split
Sidebar split to view and manage tasks.
![sidebar](doc/sidebar.png)
### Prompt
Prompt to quickly add new tasks.
![prompt](doc/prompt.png)
## Requirements
- Neovim 0.5.0
- [nui.nvim](https://github.com/MunifTanjim/nui.nvim)
## Installation
With [packer.nvim](https://github.com/wbthomason/packer.nvim):
```lua
use {
'arnarg/todotxt.nvim',
requires = {'MunifTanjim/nui.nvim'},
}
```
## Quickstart
Add the `setup()` function to your init file.
For `init.lua`:
```lua
require('todotxt-nvim').setup({
todo_file = "/path/to/todo.txt",
})
```
For `init.vim`:
```vim
lua <<EOF
require('todotxt-nvim').setup({
todo_file = "/path/to/todo.txt",
})
EOF
```
## Configuration
```lua
{
todo_file = "/path/to/todo.txt",
sidebar = {
width = 40,
position = "left" | "right" | "bottom" | "top", -- default: "right"
},
capture = {
prompt = "> ",
-- Percentage is percentage of width of the whole editor
-- Integer is number of columns
width = "75%" | 50,
position = "50%",
-- Styled after https://swiftodoapp.com/todotxt-syntax/priority/
-- With this, if you include any of the below keywords it will
-- automatically use the associated priority and remove that
-- keyword from the final task.
alternative_priority = {
A = "now",
B = "next",
C = "today",
D = "this week",
E = "next week",
},
},
-- Highlights used in both capture prompt and tasks sidebar
-- Each highlight type can be a table with 'fg', 'bg' and 'style'
-- options or a string referencing an existing highlight group.
-- highlights = {
-- project = "Identifier",
-- }
highlights = {
project = {
fg = "magenta",
bg = "NONE",
style = "NONE",
},
context = {
fg = "cyan",
bg = "NONE",
style = "NONE",
},
date = {
fg = "NONE",
bg = "NONE",
style = "underline",
},
done_task = {
fg = "gray",
bg = "NONE",
style = "NONE",
},
priorities = {
A = {
fg = "red",
bg = "NONE",
style = "bold",
},
B = {
fg = "magenta",
bg = "NONE",
style = "bold",
},
C = {
fg = "yellow",
bg = "NONE",
style = "bold",
},
D = {
fg = "cyan",
bg = "NONE",
style = "bold",
},
},
},
-- Keymap used in sidebar split
keymap = {
quit = "q",
toggle_metadata = "m",
delete_task = "dd",
complete_task = "<space>",
edit_task = "ee",
},
}
```
## Usage
### Commands
`:ToDoTxtCapture`: Opens up a prompt to add a new task.
`:ToDoTasksToggle`: Opens up a sidebar split with tasks parsed from todo.txt file provided to `setup()`. There is also `:ToDoTasksOpen` and `:ToDoTasksClose` available.
### Keymap in sidebar split
| Keymap | Action |
|-----------|--------------------------------------------|
| `e` | Edit task under cursor |
| `dd` | Delete task under cursor |
| `<space>` | Toggles task under cursor as done/not done |
| `m` | Toggle metadata for task |
| `q` | Close sidebar pane |
|