feat(init): multi-level priority with <C-a>/<C-x>

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).
This commit is contained in:
Barrett Ruth 2026-02-24 22:01:21 -05:00 committed by Barrett Ruth
parent aae6989a19
commit fc4a47a1ec
5 changed files with 60 additions and 13 deletions

View file

@ -34,10 +34,11 @@ function M.parse_buffer(lines)
table.insert(result, { type = 'blank', lnum = i })
elseif id or body then
local stripped = body:match('^ (.+)$') or body
local prio_str = stripped:match('^%[(%d+)%] ')
local priority = 0
if stripped:match('^! ') then
priority = 1
stripped = stripped:sub(3)
if prio_str then
priority = tonumber(prio_str)
stripped = stripped:sub(#prio_str + 4)
end
local description, metadata = parse.body(stripped)
if description and description ~= '' then