pending.nvim/plugin/pending.lua
Barrett Ruth fe15721c6f 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).
2026-02-24 22:20:18 -05:00

43 lines
1.1 KiB
Lua

if vim.g.loaded_pending then
return
end
vim.g.loaded_pending = true
vim.api.nvim_create_user_command('Pending', function(opts)
require('pending').command(opts.args)
end, {
nargs = '*',
complete = function(arg_lead, cmd_line)
local subcmds = { 'add', 'sync', 'archive' }
if not cmd_line:match('^Pending%s+%S') then
return vim.tbl_filter(function(s)
return s:find(arg_lead, 1, true) == 1
end, subcmds)
end
return {}
end,
})
vim.keymap.set('n', '<Plug>(pending-open)', function()
require('pending').open()
end)
vim.keymap.set('n', '<Plug>(pending-toggle)', function()
require('pending').toggle_complete()
end)
vim.keymap.set('n', '<Plug>(pending-view)', function()
require('pending.buffer').toggle_view()
end)
vim.keymap.set('n', '<Plug>(pending-priority-up)', function()
require('pending').change_priority(1)
end)
vim.keymap.set('n', '<Plug>(pending-priority-down)', function()
require('pending').change_priority(-1)
end)
vim.keymap.set('n', '<Plug>(pending-date)', function()
require('pending').prompt_date()
end)