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
+18
View File
@@ -651,6 +651,24 @@ call s:record(
\ 'cmd.VimwikiTable_accepts_cols_rows',
\ 'err=' . s:tbl_err)
" ===== :VimwikiListChangeLvl -range -nargs=+ =====
" Was -nargs=? (range-less): `:1,3VimwikiListChangeLvl increase 0` raised E481
" (no range allowed) and/or E488 (trailing chars). The level change is an LSP
" roundtrip (no server here), so assert only the attribute parse: no E481/E488.
call s:set_buf(['- a', '- b', '- c'])
let s:lcl_err = ''
try
silent 1,3VimwikiListChangeLvl increase 0
catch /E481\|E488/
let s:lcl_err = v:exception
catch
" non-attribute error (e.g. no LSP) is expected and fine here.
endtry
call s:record(
\ s:lcl_err ==# '' ? 1 : 0,
\ 'cmd.VimwikiListChangeLvl_accepts_range_and_args',
\ 'err=' . s:lcl_err)
" ===== Wrap up =====
call add(s:results, '')
+15
View File
@@ -834,6 +834,21 @@ vim.defer_fn(function()
error('want 5 table lines (hdr+sep+3 rows), got ' .. #tbl)
end
end)
-- `:[range]VimwikiListChangeLvl {dir} [plus_children]` — now -range -nargs=+
-- (was -nargs=?, range-less). A 1,3 range with `increase` must indent the
-- items that have somewhere to nest (the 2nd item under the 1st).
tobj_case('cmd.ListChangeLvl_range_indents', function()
set_buf({ '- a', '- b', '- c' })
vim.cmd('1,3VimwikiListChangeLvl increase 0')
local done = vim.wait(2000, function()
local l = vim.api.nvim_buf_get_lines(0, 0, -1, false)
return l[2] ~= nil and l[2]:match('^%s%s*%-') ~= nil
end, 30)
if not done then
error('range list-change-lvl did not indent: '
.. vim.inspect(vim.api.nvim_buf_get_lines(0, 0, -1, false)))
end
end)
-- `:VimwikiNormalizeLink 1` (the arg is upstream's visual flag; the command
-- is -nargs=? not -range, so no `'<,'>`) wraps the last visual selection.
tobj_case('cmd.normalize_link_visual_wraps_selection', function()