feat(commands): VimwikiListChangeLvl -range -nargs=+ (P3 parity)
CI / cargo fmt --check (push) Successful in 17s
CI / cargo clippy (push) Successful in 28s
CI / cargo test (push) Successful in 50s
CI / editor keymaps (push) Successful in 1m58s

Upstream is `-range -nargs=+` (change_level(line1, line2, direction,
plus_children)); nuwiki was -nargs=? and range-less, so `:1,3VimwikiListChangeLvl
increase 0` raised E481/E488 and the level change never spanned a selection.

All four defs (Vim+Neovim × Vimwiki+Nuwiki) are now -range -nargs=+ and forward
<line1>, <line2>, <f-args>. list_change_lvl(line1, line2, direction,
[plus_children]) (both clients) parses the required direction + optional subtree
flag and applies the change to every list item in the range via the existing
over_range helper.

Tests: cmd.ListChangeLvl_range_indents (test-keymaps.lua) +
cmd.VimwikiListChangeLvl_accepts_range_and_args (test-keymaps-vim.vim).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 20:16:10 +00:00
parent fe116088bb
commit 4710ba03c8
6 changed files with 62 additions and 14 deletions
+7 -4
View File
@@ -585,11 +585,14 @@ function M.list_change_level(delta, whole_subtree)
exec('nuwiki.list.changeLevel', { args })
end
-- Vimwiki's `:VimwikiListChangeLvl decrease|increase 0` keeps a single
-- entry point. Forward to changeLevel.
function M.list_change_lvl(direction)
-- `:[range]VimwikiListChangeLvl {increase|decrease} [plus_children]` — upstream
-- is `-range -nargs=+`. Direction is required; the optional second arg cascades
-- to each item's subtree; a range applies it to every list item in the range.
function M.list_change_lvl(line1, line2, direction, plus_children)
local delta = (direction == 'increase' or direction == 'indent') and 1 or -1
M.list_change_level(delta, false)
local n = tonumber(plus_children)
local children = n ~= nil and n ~= 0
over_range(line1, line2, function() M.list_change_level(delta, children) end)
end
--- Cycle the list marker forward (`direction = 1`) or backward