diff --git a/doc/pending.txt b/doc/pending.txt index 5cca48e..7a0b6e1 100644 --- a/doc/pending.txt +++ b/doc/pending.txt @@ -352,8 +352,10 @@ Default buffer-local keys: ~ `gz` Undo the last `:w` save (`undo`) `o` Insert a new task line below (`open_line`) `O` Insert a new task line above (`open_line_above`) - `` Increment priority (clamped at `max_priority`) (`priority_up`) - `` Decrement priority (clamped at 0) (`priority_down`) + `` Increment priority — normal: single task, visual: all + selected tasks (`priority_up`) + `` Decrement priority — normal: single task, visual: all + selected tasks (`priority_down`) `g` Increment priority for visual selection (`priority_up_visual`) `g` Decrement priority for visual selection (`priority_down_visual`) `J` Move task down within its category (`move_down`) @@ -472,13 +474,29 @@ old keys to `false`: >lua *(pending-priority-up)* (pending-priority-up) - Increment the priority level for the task under the cursor, clamped - at `max_priority`. Default key: ``. + Normal mode: increment the priority level for the task under the + cursor, clamped at `max_priority`. + Visual mode: increment priority for all tasks in the selection. + Works in charwise (`v`), linewise (`V`), and blockwise (``) + visual modes. Default key: ``. *(pending-priority-down)* (pending-priority-down) - Decrement the priority level for the task under the cursor, clamped - at 0. Default key: ``. + Normal mode: decrement the priority level for the task under the + cursor, clamped at 0. + Visual mode: decrement priority for all tasks in the selection. + Works in charwise (`v`), linewise (`V`), and blockwise (``) + visual modes. Default key: ``. + + *(pending-priority-up-visual)* +(pending-priority-up-visual) + Increment priority for all tasks in the visual selection. Alias for + `(pending-priority-up)` in visual mode. Default key: `g`. + + *(pending-priority-down-visual)* +(pending-priority-down-visual) + Decrement priority for all tasks in the visual selection. Alias for + `(pending-priority-down)` in visual mode. Default key: `g`. *(pending-open-line)* (pending-open-line) diff --git a/lua/pending/init.lua b/lua/pending/init.lua index 529954b..80358b7 100644 --- a/lua/pending/init.lua +++ b/lua/pending/init.lua @@ -404,6 +404,12 @@ function M._setup_buf_mappings(bufnr) ---@type table local visual_actions = { + priority_up = function() + M.increment_priority_visual() + end, + priority_down = function() + M.decrement_priority_visual() + end, priority_up_visual = function() M.increment_priority_visual() end, diff --git a/plugin/pending.lua b/plugin/pending.lua index 62e2e89..47412b0 100644 --- a/plugin/pending.lua +++ b/plugin/pending.lua @@ -402,6 +402,16 @@ vim.keymap.set('n', '(pending-priority-down)', function() require('pending').decrement_priority() end) +vim.keymap.set('x', '(pending-priority-up)', function() + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('', true, false, true), 'nx', false) + require('pending').increment_priority_visual() +end) + +vim.keymap.set('x', '(pending-priority-down)', function() + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('', true, false, true), 'nx', false) + require('pending').decrement_priority_visual() +end) + vim.keymap.set('x', '(pending-priority-up-visual)', function() vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('', true, false, true), 'nx', false) require('pending').increment_priority_visual()