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.
This commit is contained in:
Barrett Ruth 2026-02-24 23:15:02 -05:00
parent d243d5897a
commit ce00f28c96
2 changed files with 15 additions and 53 deletions

View file

@ -8,7 +8,7 @@ vim.api.nvim_create_user_command('Pending', function(opts)
end, {
nargs = '*',
complete = function(arg_lead, cmd_line)
local subcmds = { 'add', 'sync', 'archive' }
local subcmds = { 'add', 'sync', 'archive', 'due', 'undo' }
if not cmd_line:match('^Pending%s+%S') then
return vim.tbl_filter(function(s)
return s:find(arg_lead, 1, true) == 1
@ -30,12 +30,8 @@ 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)
vim.keymap.set('n', '<Plug>(pending-priority)', function()
require('pending').toggle_priority()
end)
vim.keymap.set('n', '<Plug>(pending-date)', function()