feat(commands): VimwikiListChangeLvl -range -nargs=+ (P3 parity)
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user