Skip to content

Commit ea6250c

Browse files
authored
Merge develop branch (#166)
As part of v0.11 release
2 parents b544f3f + cbd9921 commit ea6250c

40 files changed

+6146
-1689
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
vendor/plenary.nvim
22
consolidated.md
33
tests/fixtures
4-
tests/environments.lua
54

65
logs/
76

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
.PHONY: test test-file test-interactive clean
22

3+
# allow `make test DEBUG=1` (or any other target) to export DEBUG=1
4+
DEBUG ?= 0
5+
ifeq ($(DEBUG),1)
6+
export DEBUG
7+
endif
8+
39
FILE ?= $(f)
410
TEST ?= $(t)
5-
611
BASENAME := $(basename $(notdir $(FILE)))
712

813
# - If FILE is empty, leave FILE_PATH empty.

README.md

Lines changed: 85 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ A Markdown-based todo/task plugin for Neovim.
2525
- Smart toggling behavior
2626
- Archive completed todos
2727
- Todo templates with LuaSnip snippet integration
28-
- 🆕 Custom todo states!
28+
- Custom todo states
2929
- More than just "checked" and "unchecked", e.g. "partial", "in-progress", "on-hold"
30+
- 🆕 Automatic todo creation (list continuation in insert mode)
3031

3132
> [!NOTE]
3233
> Check out the [Wiki](https://github.com/bngarren/checkmate.nvim/wiki) for additional documentation and recipes, including:
@@ -42,7 +43,6 @@ A Markdown-based todo/task plugin for Neovim.
4243
<img width="1200" height="341" alt="checkmate_demo_complex" src="https://github.com/user-attachments/assets/8bbb9b20-23f7-4f82-b2b3-a8e8d2d9d4c5" />
4344

4445

45-
4646
https://github.com/user-attachments/assets/d9b58e2c-24e2-4fd8-8d7f-557877a20218
4747

4848
<!-- panvimdoc-ignore-start -->
@@ -158,7 +158,7 @@ The Checkmate buffer is **saved as regular Markdown** which means it's compatibl
158158
|--------------|-------------|
159159
| `archive` | Archive all checked todo items in the buffer. See api `archive()` |
160160
| `check` | Mark the todo item under the cursor as checked. See api `check()`|
161-
| `create` | Create a new todo item at the current line or line below if a todo already exists. In visual mode, convert each line to a todo item. See api `create()`|
161+
| `create` | In normal mode, converts the current line into a todo (or if already a todo, creates a sibling below). In visual mode, converts each selected line into a todo. In insert mode, creates a new todo on the next line and keeps you in insert mode. For more advanced placement, indentation, and state options, see the `create(opts)` API. |
162162
| `cycle_next` | Cycle a todo's state to the next available. See api `cycle()` |
163163
| `cycle_previous` | Cycle a todo's state to the previous. See api `cycle()` |
164164
| `lint` | Lint this buffer for Checkmate formatting issues. See api `lint()` |
@@ -168,6 +168,7 @@ The Checkmate buffer is **saved as regular Markdown** which means it's compatibl
168168
| `metadata remove` | Remove a specific metadata tag from the todo under the cursor or within the selection. Usage: `:Checkmate metadata remove <key>`. See api `remove_metadata(key)` |
169169
| `metadata select_value` | Select a value from the 'choices' option for the metadata tag under the cursor. See api `select_metadata_value()` |
170170
| `metadata toggle` | Toggle a metadata tag on/off for the todo under the cursor or within the selection. Usage: `:Checkmate metadata toggle <key> [value]`. See api `toggle_metadata(key, value)` |
171+
| `remove` | Convert a todo line back to regular text. See api `remove(opts)`. By default, will preserve the list item marker and remove any metadata. This can be configured via `opts`.
171172
| `remove_all_metadata` | Remove *all* metadata tags from the todo under the cursor or within the selection. See api `remove_all_metadata()` |
172173
| `toggle` | Toggle the todo item under the cursor (normal mode) or all todo items within the selection (visual mode). See api `toggle()`. This command only toggles between `unchecked` and `checked`. To change to custom states, use the api `toggle(target_state)` or the `cycle_*` commands. |
173174
| `uncheck` | Mark the todo item under the cursor as unchecked. See api `uncheck()` |
@@ -182,6 +183,7 @@ The Checkmate buffer is **saved as regular Markdown** which means it's compatibl
182183
<summary>Config definitions/annotations</summary>
183184

184185
```lua
186+
-----------------------------------------------------
185187
---Checkmate configuration
186188
---@class checkmate.Config
187189
---
@@ -238,7 +240,7 @@ The Checkmate buffer is **saved as regular Markdown** which means it's compatibl
238240
---
239241
---The states that a todo item may have
240242
---Default: "unchecked" and "checked"
241-
---Note that Gith[118;1:3uub-flavored Markdown specification only includes "checked" and "unchecked".
243+
---Note that Github-flavored Markdown specification only includes "checked" and "unchecked".
242244
---
243245
---If you add additional states here, they may not work in other Markdown apps without special configuration.
244246
---@field todo_states table<string, checkmate.TodoStateDefinition>
@@ -254,8 +256,15 @@ The Checkmate buffer is **saved as regular Markdown** which means it's compatibl
254256
---@field style checkmate.StyleSettings?
255257
---
256258
---Enter insert mode after `:Checkmate create`, require("checkmate").create()
259+
---Default: true
257260
---@field enter_insert_after_new boolean
258261
---
262+
---List continuation refers to the automatic creation of new todo lines when insert mode keymaps are fired, i.e., typically <CR>
263+
---To offer optimal configurability and integration with other plugins, you can set the exact keymaps and their functions via the `keys` option. The list continuation functionality can also be toggled via the `enabled` option.
264+
--- - When enabled and keymap calls `create()`, it will create a new todo line, using the origin/current row with reasonable defaults
265+
--- - Works for both raw Markdown (e.g. `- [ ]`) and Unicode style (e.g. `- ☐`) todos.
266+
---@field list_continuation checkmate.ListContinuationSettings
267+
---
259268
---Smart toggle provides intelligent parent-child todo state propagation
260269
---
261270
---When you change a todo's state, it can automatically update related todos based on their
@@ -275,14 +284,14 @@ The Checkmate buffer is **saved as regular Markdown** which means it's compatibl
275284
---@field todo_count_position checkmate.TodoCountPosition
276285
---
277286
---Formatter function for displaying the todo count indicator
278-
---@field todo_count_formatter fun(completed: integer, total: integer)?: string
287+
---@field todo_count_formatter? fun(completed: integer, total: integer): string
279288
---
280289
---Whether to count child todo items recursively in the todo_count
281290
---If true, all nested todo items will count towards the parent todo's count
282291
---@field todo_count_recursive boolean
283292
---
284-
---Whether to register keymappings defined in each metadata definition. If set the false,
285-
---metadata actions need to be called programatically or otherwise mapped manually
293+
---Whether to register keymappings defined in each metadata definition.
294+
---When false, default metadata keymaps are not created; you can still call require('checkmate').toggle_metadata() or bind keys manually.
286295
---@field use_metadata_keymaps boolean
287296
---
288297
---Custom @tag(value) fields that can be toggled on todo items
@@ -311,6 +320,7 @@ The Checkmate buffer is **saved as regular Markdown** which means it's compatibl
311320
---@field level ("trace" | "debug" | "info" | "warn" | "error" | "fatal" | vim.log.levels.DEBUG | vim.log.levels.ERROR | vim.log.levels.INFO | vim.log.levels.TRACE | vim.log.levels.WARN)?
312321
---
313322
--- Should print log output to a file
323+
--- Default: true
314324
---@field use_file boolean
315325
---
316326
--- The default path on-disk where log files will be written to.
@@ -324,16 +334,17 @@ The Checkmate buffer is **saved as regular Markdown** which means it's compatibl
324334

325335
-----------------------------------------------------
326336

337+
---The broad categories used internally that give semantic meaning to each todo state
327338
---@alias checkmate.TodoStateType "incomplete" | "complete" | "inactive"
328339

329340
---@class checkmate.TodoStateDefinition
330341
---
331-
--- The text string used for a todo marker is expected to be 1 character length.
342+
--- The glyph or text string used for a todo marker is expected to be 1 character length.
332343
--- Multiple characters _may_ work but are not currently supported and could lead to unexpected results.
333344
---@field marker string
334345
---
335346
--- Markdown checkbox representation (custom states only)
336-
--- For custom states, this determines how the todo state is written in Markdown syntax.
347+
--- For custom states, this determines how the todo state is written to file in Markdown syntax.
337348
--- Important:
338349
--- - Must be unique among all todo states. If two states share the same Markdown representation, there will
339350
--- be unpredictable behavior when parsing the Markdown into the Checkmate buffer
@@ -383,6 +394,42 @@ The Checkmate buffer is **saved as regular Markdown** which means it's compatibl
383394

384395
-----------------------------------------------------
385396

397+
---@class checkmate.ListContinuationSettings
398+
---
399+
--- Whether to enable list continuation behavior
400+
---
401+
--- Default: true
402+
---@field enabled? boolean
403+
---
404+
--- Control behavior when cursor is mid-line (not at the end).
405+
---
406+
--- When `true` (default):
407+
--- - Text after cursor moves to the new todo line
408+
--- - Original line is truncated at cursor position
409+
--- - Example: "- ☐ Buy |milk and eggs" → "- ☐ Buy" + "- ☐ milk and eggs"
410+
---
411+
--- When `false`:
412+
--- - List continuation only works when cursor is at end of line
413+
---
414+
--- Default: true
415+
---@field split_line? boolean
416+
---
417+
--- Define which keys trigger list continuation and their behavior.
418+
---
419+
--- Each key can map to either:
420+
--- - A function that creates the new todo
421+
--- - A table with `rhs` (function) and optional `desc` (description)
422+
---
423+
--- Default keys:
424+
--- - `<CR>`: Create sibling todo (same indentation)
425+
--- - `<S-CR>`: Create nested todo (indented as child)
426+
---
427+
--- **Important**: This field completely replaces the default keys (no merging).
428+
--- To keep some defaults while adding custom keys, explicitly include them in your config.
429+
---@field keys? table<string, {rhs: function, desc?: string}|function>
430+
---
431+
-----------------------------------------------------
432+
386433
---@class checkmate.SmartToggleSettings
387434
---
388435
---Whether to enable smart toggle behavior
@@ -476,7 +523,7 @@ The Checkmate buffer is **saved as regular Markdown** which means it's compatibl
476523
---i.e. what is used after insertion
477524
---@field get_value? checkmate.GetValueFn
478525
---
479-
---@alias checkmate.ChoicesFn fun(context?: checkmate.MetadataContext, cb?: fun(items: string[])): string[]?
526+
---@alias checkmate.ChoicesFn fun(context?: checkmate.MetadataContext, cb?: fun(items: string[])): string[]|nil
480527
---
481528
---Values that are populated during completion or select pickers
482529
---Can be either:
@@ -613,6 +660,11 @@ return {
613660
desc = "Create todo item",
614661
modes = { "n", "v" },
615662
},
663+
["<leader>Tr"] = {
664+
rhs = "<cmd>Checkmate remove<CR>",
665+
desc = "Remove todo marker (convert to text)",
666+
modes = { "n", "v" },
667+
},
616668
["<leader>TR"] = {
617669
rhs = "<cmd>Checkmate remove_all_metadata<CR>",
618670
desc = "Remove all metadata from a todo item",
@@ -655,6 +707,24 @@ return {
655707
},
656708
style = {}, -- override defaults
657709
enter_insert_after_new = true, -- Should enter INSERT mode after `:Checkmate create` (new todo)
710+
list_continuation = {
711+
enabled = true,
712+
split_line = true,
713+
keys = {
714+
["<CR>"] = function()
715+
require("checkmate").create({
716+
position = "below",
717+
indent = false,
718+
})
719+
end,
720+
["<S-CR>"] = function()
721+
require("checkmate").create({
722+
position = "below",
723+
indent = true,
724+
})
725+
end,
726+
},
727+
},
658728
smart_toggle = {
659729
enabled = true,
660730
include_cycle = false,
@@ -873,7 +943,6 @@ todo_states = {
873943

874944
<img width="800" height="145" alt="checkmate_custom_states" src="https://github.com/user-attachments/assets/b8f89d00-4523-4106-8dbe-82059b1a1334" />
875945

876-
877946
#### State types
878947
States have three behavior types that affect smart toggle and todo counts:
879948
| Type | Behavior | Example States |
@@ -1009,11 +1078,13 @@ For in-depth guide and recipes for custom metadata, see the [Wiki](https://githu
10091078
<a id="archiving"><a/>
10101079

10111080
# ☑️ Archiving
1012-
Allows you to easily reorganize the buffer by moving all checked/completed todo items to a Markdown section beneath all other content. The unchecked todos are reorganized up top and spacing is adjusted.
1081+
Allows you to easily reorganize the buffer by moving all **completed** todo items to a Markdown section beneath all other content. The remaining unchecked/incomplete todos are reorganized up top and spacing is adjusted.
1082+
1083+
Archiving collects all todos with the "completed" [state type](#state-types), which includes the default "checked" state, but possibly others based on custom todo states.
10131084

10141085
See `Checkmate archive` command or `require("checkmate").archive()`
10151086

1016-
> Current behavior (could be adjusted in the future): a checked todo item that is nested under an unchecked parent will not be archived. This prevents 'orphan' todos being separated from their parents. Similarly, a checked parent todo will carry all nested todos (checked and unchecked) when archived.
1087+
> Current behavior (could be adjusted in the future): a completed todo item that is nested under an incomplete parent will not be archived. This prevents 'orphan' todos being separated from their parents. Similarly, a completed parent todo will carry all nested todos (completed and incomplete) when archived.
10171088
10181089
#### Heading
10191090
By default, a Markdown level 2 header (##) section named "**Archive**" is used. You can configure the archive section heading via `config.archive.heading`
@@ -1119,7 +1190,7 @@ Planned features:
11191190

11201191
- [x] **Custom todo states** - support beyond binary "checked" and "unchecked", allowing for todos to be in custom states, e.g. pending, not-planned, on-hold, etc. _Added v0.10.0_
11211192

1122-
- [ ] Sorting API - user can register custom sorting functions and keymap them so that sibling todo items can be reordered quickly. e.g. `function(todo_a, todo_b)` should return an integer, and where todo_a/todo_b is a table containing data such as checked state and metadata tag/values
1193+
- [x] **List (todo) continuation** - automatically created new todo lines in insert mode, e.g. `<CR>` on a todo line will create a new todo below. _Added v0.11.0_
11231194

11241195
<a id="contributing"><a/>
11251196

0 commit comments

Comments
 (0)