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
+9 -5
View File
@@ -800,11 +800,15 @@ function! nuwiki#commands#list_change_level(delta, whole_subtree) abort
call s:exec('nuwiki.list.changeLevel', l:args)
endfunction
" `:VimwikiListChangeLvl decrease|increase 0` compat entry.
function! nuwiki#commands#list_change_lvl(...) abort
let l:dir = a:0 >= 1 ? a:1 : 'increase'
let l:delta = (l:dir ==# 'increase' || l:dir ==# 'indent') ? 1 : -1
call nuwiki#commands#list_change_level(l:delta, 0)
" `:[range]VimwikiListChangeLvl {increase|decrease} [plus_children]` — upstream
" is `-range -nargs=+`: direction is required, the optional second arg cascades
" the level change to each item's subtree, and a range applies it to every list
" item in the selection.
function! nuwiki#commands#list_change_lvl(line1, line2, direction, ...) abort
let l:delta = (a:direction ==# 'increase' || a:direction ==# 'indent') ? 1 : -1
let l:children = a:0 >= 1 ? (str2nr(a:1) != 0) : 0
call s:over_range(a:line1, a:line2,
\ { -> nuwiki#commands#list_change_level(l:delta, l:children) })
endfunction
" Cycle the list marker through vimwiki's canonical order.