* feat(buffer): open as bottom-drawer split like fugitive
Problem: :Pending replaced the current buffer, making it impossible to
view tasks alongside the file being edited. No way to close the drawer
without :q or switching buffers manually.
Solution: open the task buffer in a botright horizontal split instead of
replacing the current buffer. Track the drawer window ID so re-opening
focuses it rather than creating a second split. Set winfixheight so the
drawer keeps its height when other windows open or close. Add q/<Esc>
mappings to close the drawer, and a WinClosed autocmd to clear the
tracked window ID when the user closes it manually. Add drawer_height
config option (default 15).
* fix(buffer): default to natural split height like fugitive
Problem: hardcoded drawer_height=15 was too small and diverged from
fugitive's model. Fugitive issues a plain botright split and lets Vim's
own split rules (equalalways, winheight) divide the available space.
Solution: remove the default height so the split sizes naturally. Only
call nvim_win_set_height when the user sets drawer_height to a positive
value, preserving the opt-in customization path.
* refactor(config): change default category from Inbox to Todo
* refactor(views): adopt markdown checkbox line format
Problem: task lines used an opaque /ID/ [N] prefix format that was
hard to read and inconsistent between category and priority views.
Header lines had no visual marker distinguishing them from tasks.
Solution: render headers as '## Cat', task lines as
'/ID/- [x|!| ] description'. State encoding: [x]=done, [!]=urgent,
[ ]=pending. Both views use the same construction.
* refactor(diff): parse and reconcile markdown checkbox format
Problem: parse_buffer matched the old ' text' indent pattern and
detected headers via '^%S'. Priority was read from a '[N] ' prefix.
apply() never reconciled status changes written into the buffer.
Solution: match '- [.] text' for tasks and '^## ' for headers.
Extract state char to derive priority (! -> 1) and status (x -> done).
apply() now reconciles status from the buffer, setting/clearing 'end'
timestamps — enabling the oil-style edit-checkbox-then-:w workflow.
* refactor(buffer): update syntax, extmarks, and render for checkbox format
Problem: syntax patterns matched the old indent/[N] format; right_align
virtual text produced a broken layout in narrow windows; the done
strikethrough skipped past the ' ' indent leaving '- [x] ' unstyled;
render() added undo history entries so 'u' could undo a re-render.
Solution: update taskHeader/taskLine patterns for '## '/'- [.]'; rename
taskPriority -> taskCheckbox matching '[!]'; switch virt_text_pos to
'eol'; drop the +2 col_start offset so strikethrough covers '- [x] ';
guard nvim_buf_set_lines with undolevels=-1 so renders are not undoable.
Also fix open_line to insert '- [ ] ' and position cursor at col 6.
* refactor(init): replace multi-level priority with binary toggle
Problem: <C-a>/<C-x> overrode Vim's native number increment and the
visual g<C-a>/g<C-x> variants added complexity for marginal value.
toggle_complete() left the cursor on the wrong line after re-render.
Solution: remove change_priority/change_priority_visual; add
toggle_priority() (0<->1) mapped to '!', with cursor-follow after
render matching the pattern already used in priority toggle. Add
cursor-follow to toggle_complete() for the same reason. Update plugin
plugs (priority-up/down -> priority) and add 'due'/'undo' to the
:Pending completion list. Update help text accordingly.
* feat(buffer): reflect current view in buffer name
Problem: no way to tell at a glance which view (category vs priority)
is active — the buffer was always named 'pending://'.
Solution: update the buffer name to 'pending://category' or
'pending://priority' on every render, so the view is visible in
the statusline/tabline without any extra UI.
* test: add top-priority missing test coverage
Problem: several critical code paths had zero test coverage —
parse.resolve_date (relative date resolution), store.snapshot
(foundation of the undo stack), and the diff.apply invariant that
unchanged tasks do not get their modified timestamp bumped. The
diff.apply due/priority clearing paths were also untested.
Solution: add six targeted test blocks across parse_spec, store_spec,
and diff_spec: resolve_date happy/failure paths, parse.body with
relative due tokens, snapshot copy-semantics and deleted-task
exclusion, diff unchanged-modified invariant, due cleared on removal,
priority cleared on ! removal.
* test: add second batch of missing test coverage
Problem: six more gaps from the audit remained after the first batch —
archive persistence verification, diff modified-on-rename, parse_buffer
inline cat:/due: token parsing, and store.update immutability invariants.
Solution: add six it() blocks across archive_spec, diff_spec, and
store_spec: archive unload/reload persistence check, modified timestamp
updated on description change, inline cat: overrides header category,
inline due: token parsed from buffer line, id/entry fields immutable
under store.update, and end timestamp not overwritten on second
completion.
Problem: fc4a47a changed the priority display format from '! ' to
'[N] ' in views.lua and diff.lua but left two existing test
assertions and their descriptions using the old format, causing
both to fail.
Solution: update the input line in diff parse_buffer test, update
the expected string and description names in views category_view
test, and rename the diff.apply description to match the new idiom.
Problem: LuaLS infers priority as integer from the = 0 initialiser
but tonumber returns number?, causing a cast-local-type diagnostic.
Solution: inline --[[@as integer]] cast after the tonumber call.
Problem: pressing :w, toggling priority, or any other operation that
calls buffer.render() reset foldlevel = 99, causing all manually
collapsed category sections to snap back open.
Solution: snapshot which categories are folded (per window) before
nvim_buf_set_lines destroys the fold tree, then restore them after
fold options are re-applied by calling normal! zc on each previously
closed header line. State persists across all render call sites
within a session.
Problem: priority was binary (0 or 1), toggled with !, with no way
to express finer gradations or use Vim's native increment idiom.
Solution: replace toggle_priority with change_priority(delta) which
clamps to floor 0. Display format changes from '! ' to '[N] ' so any
integer level is representable. Parser updated to extract numeric
level from the [N] prefix. Visual g<C-a>/g<C-x> apply the delta to
all tasks in the selection. <Plug>(pending-priority) replaced with
<Plug>(pending-priority-up) and <Plug>(pending-priority-down).
Problem: several critical code paths had zero test coverage —
parse.resolve_date (relative date resolution), store.snapshot
(foundation of the undo stack), and the diff.apply invariant that
unchanged tasks do not get their modified timestamp bumped. The
diff.apply due/priority clearing paths were also untested.
Solution: add six targeted test blocks across parse_spec, store_spec,
and diff_spec: resolve_date happy/failure paths, parse.body with
relative due tokens, snapshot copy-semantics and deleted-task
exclusion, diff unchanged-modified invariant, due cleared on removal,
priority cleared on ! removal.
Problem: doc/pending.txt was written before the undo stack, folds,
:Pending due, D mapping, and BufEnter reload were added. Several
entries were factually wrong (single-level undo, d vs D key,
:Pending undo listed as non-existent) and highlight group defaults
referenced stale hex colours.
Solution: correct all factual errors and add missing entries —
:Pending due command, :Pending undo command, zc/zo fold mappings,
PendingOverdue highlight group, semantic link defaults for all groups,
category fold docs, BufEnter auto-reload note, and multi-level undo
description.
Problem: setup_indentexpr always returned 0 because no task line
starts with whitespace (the /ID/ prefix begins with /), so the
return 2 branch was dead code. Pressing o or O opened a blank line
at column 0 with no ID prefix, which the diff parser cannot
recognise as a task.
Solution: remove setup_indentexpr and M.get_indent() entirely; add
M.open_line(above) which inserts a two-space stub line and enters
insert mode at the end so the user types directly into the new task
body. The diff layer already handles lines matching ^ .+ as new
tasks. Add o and O buffer-local mappings in init.lua.
Problem: pressing ! re-sorts the view so the toggled task moves to
the top of its category, but the cursor stays on the original line
number and lands on a different task.
Solution: after buffer.render(), iterate buffer.meta() to find the
new line number for the toggled task's id and call
nvim_win_set_cursor to follow it.
Problem: highlight groups used hardcoded hex colours and a bespoke
hlexists guard, ignoring the user's colorscheme and preventing
overrides from working naturally.
Solution: replace the guard wrapper with direct nvim_set_hl calls
using default = true and link, so each group falls back to a
semantically appropriate built-in group (Title, DiagnosticHint,
DiagnosticError, Comment, DiagnosticWarn) unless the user has
already defined them.
Problem: mapping d for the date prompt intercepts dd before Vim can
recognize it as a motion, so dd never deletes a line.
Solution: move the date prompt to D, restoring full d-operator
behaviour (dd, dw, d$, etc.) and updating the help popup to match.
Problem: CI lua-typecheck-action reported three categories of errors:
1. parse.lua - multi-assignment of tonumber() results left y/m/d typed
as number? rather than integer, failing os.time()'s field types
2. gcal.lua - url_encode returned str:gsub() which yields string+integer
but the annotation declared @return string (redundant-return-value)
3. gcal.lua - calendar_id typed string? from find_or_create_calendar was
passed to functions expecting string; the existing `if err` guard did
not narrow the type for LuaLS
Solution: replace the y/m/d multi-assignment with yn/mn/dn locals whose
types resolve cleanly to integer; wrap the gsub return in parentheses to
discard the count; add `or not calendar_id` to the error guard so LuaLS
narrows calendar_id to string for the rest of the scope.
Problem: undo was single-level with shallow references; no way to
query due/overdue tasks via quickfix; two instances sharing
tasks.json would diverge silently.
Solution: replace _undo_state with _undo_states[] (cap 20, deep
copies via store.snapshot()); add M.due() which populates the
quickfix list with overdue/due-today tasks; add BufEnter autocmd
that reloads from disk when the buffer is unmodified; expand
show_help() with folds, :Pending due, relative date syntax,
PendingOverdue, and empty-input date clearing.
Problem: category_view had no fold support, making it harder to
focus on one category in large lists.
Solution: add M.get_fold() returning '>1' for headers, '1' for task
lines, and '0' for blanks. M.render() now sets foldmethod=expr
(foldlevel=99) in category view and foldmethod=manual in priority.
Problem: the single-level undo used shallow references so mutations
during diff.apply() corrupted the saved state. JSON writes were also
non-atomic, risking partial writes on crash.
Solution: add M.snapshot() which deep-copies active tasks (including
_extra). Change M.save() to write a .tmp file then rename atomically.
Problem: gcal.lua had ~10 LuaLS errors from untyped credential and
token tables, string|osdate casts, and untyped _gcal_event_id
field access.
Solution: add pending.GcalCredentials and pending.GcalTokens class
definitions, annotate all local functions with @param/@return, add
--[[@as string]] casts on os.date returns, and fix _gcal_event_id
access to use bracket notation with casts.
Problem: LuaLS types os.date('*t') as string|osdate, causing type
errors when accessing .year, .month, .day, .wday fields in
is_valid_date and resolve_date.
Solution: add --[[@as osdate]] casts on both os.date('*t') calls.
* feat(config): add category_order field
Problem: category display order was always insertion order with no way
to configure it.
Solution: add category_order to config defaults so users can declare a
preferred category ordering; unspecified categories append after.
* feat(parse): add relative date resolution
Problem: due dates required full YYYY-MM-DD input, adding friction for
common cases like "today" or "next monday".
Solution: add resolve_date() supporting today, tomorrow, +Nd, and
weekday abbreviations; extend inline token parsing to resolve relative
values before falling back to strict date validation.
* feat(views): overdue flag, category in priority view, category ordering
Problem: overdue tasks were visually indistinct from upcoming ones;
priority view had no category context; category display order was not
configurable.
Solution: compute overdue meta flag for pending tasks past their due
date; set show_category on priority view task meta; reorder categories
according to config.category_order when present.
* feat(buffer): overdue highlight, category virt text in priority view
Problem: overdue tasks had no visual distinction; priority view showed
no category context alongside due dates.
Solution: add PendingOverdue highlight group; render category name as
right-aligned virtual text in priority view, composited with the due
date when both are present.
* feat(init): undo write and buffer-local default mappings
Problem: _undo_state was captured on every save but never consumed;
toggle_priority and prompt_date had no buffer-local defaults, requiring
manual <Plug> configuration.
Solution: implement undo_write() to restore pre-save task state; add !,
d, and U as buffer-local defaults following fugitive's philosophy of
owning the buffer; expose :Pending undo as a command alias.
* test(views): add views spec
Problem: views.lua had no test coverage.
Solution: add 26 tests covering category_view and priority_view
including sort order, line format, overdue detection, show_category
meta, and category_order config behavior.
* test(archive): add archive spec
Problem: archive had no test coverage.
Solution: add 9 tests covering cutoff logic, custom day counts, pending
task preservation, deleted task cleanup, and notify output.
* docs: add vimdoc
Problem: no :help documentation existed.
Solution: add doc/pending.txt covering all features — commands,
mappings, views, configuration, Google Calendar sync, highlight groups,
data format, and health check — following standard vimdoc conventions.
* ci: format
* fix: resolve lint and type check errors
Problem: selene flagged unused variables in new spec files; LuaLS
flagged os.date/os.time return type mismatches, integer? assignments,
and stale task.Task/task.GcalConfig type references.
Solution: prefix unused spec variables with _ or drop unnecessary
assignments; add --[[@as string/integer]] casts for os.date and
os.time calls; add category_order field to pending.Config annotation;
fix task.GcalConfig -> pending.GcalConfig and task.Task[] ->
pending.Task[]; add nil guards on meta[row].id before store calls;
cast store.data() return to non-optional.
* ci: format
* fix: sync
* ci: format
Problem: repo had no documentation for users.
Solution: add README covering usage, configuration, inline
metadata syntax, Google Calendar sync, mappings, and data
format.
Problem: rockspec file was named 'rockspec' instead of the
luarocks-required '<package>-<version>.rockspec' format.
Solution: rename to todo.nvim-scm-1.rockspec.
Problem: unused variables (undo_state, sha_result, date match
captures) and duplicate if/else branches in gcal sync triggered
selene warnings and errors.
Solution: prefix unused state with underscore, simplify date
validation to a single pattern match, remove dead sha_result
call, and merge duplicate event deletion branches into a single
condition.
Problem: parse_buffer classified /id/-prefixed task lines as headers
because '/' matches the '^%S' header pattern. Store timestamp test
was flaky when add and update ran within the same second.
Solution: check for task line patterns (id prefix or 2-space indent)
before falling through to the header branch. Backdate the initial
modified timestamp in the store update test.
Problem: need test coverage for core data operations, inline
metadata parsing, and buffer diff algorithm.
Solution: add busted specs for store CRUD, round-trip
preservation, parse body/command_add with configurable date
syntax, and diff create/delete/update/copy/move operations.
Problem: need a way to diagnose config, data file, and
dependency issues.
Solution: add health module reporting config values, data
directory status, task count, and curl/openssl availability.
Problem: need to push tasks with due dates to Google Calendar
as all-day events.
Solution: add gcal module with OAuth 2.0 loopback flow, PKCE,
token refresh, calendar creation, and event CRUD. Maps pending
tasks to all-day events, deletes events on completion, and
stores event IDs in task _extra for round-trip.
Problem: need user-facing :Todo command, buffer-local keymaps,
Plug mappings, completion toggle, help float, archive, and
syntax highlighting.
Solution: add init.lua with command dispatcher, toggle complete/
priority, date prompt, archive purge, and help float. Add
plugin/todo.lua entry point with :Todo command and Plug mappings.
Add syntax/todo.vim for conceal and priority highlighting.
Problem: need to reconcile buffer edits against the JSON store
on :w, handling creates, deletes, updates, reorders, and
duplicate IDs from yank/paste.
Solution: add diff module that parses buffer lines, matches
against stored tasks by ID, creates new tasks for unknown or
duplicate IDs, marks removed tasks as deleted, and updates
changed fields.
Problem: need a buffer to display tasks with concealed IDs,
virtual text due dates, strikethrough for done items, and
auto-indent.
Solution: add buffer module with acwrite scratch buffer, syntax
conceal for /id/ prefixes, right-aligned due date extmarks,
header/done highlighting, indentexpr, and view toggling.
Problem: need to render task lists grouped by category or sorted
by priority with concealed IDs and metadata.
Solution: add category_view and priority_view functions that
produce buffer lines with hidden /id/ prefixes, priority flags,
and line metadata for extmark placement.
Problem: need to extract due dates and categories from task
descriptions typed in the buffer.
Solution: add right-to-left token parser for configurable date
syntax (default 'due:') and cat: metadata keys. Supports
Category: prefix syntax for :Todo add commands.
Problem: need persistent task storage with forward-compatible
schema and unknown field preservation.
Solution: add store module with load/save, add/update/delete,
ID allocation, and UDA round-trip preservation. Data stored at
stdpath('data')/todo/tasks.json with version 1 schema.
Problem: need user-configurable settings with sensible defaults.
Solution: add config module that merges vim.g.todo with defaults
for data_path, default_view, default_category, date_format, and
date_syntax.