parity(2): insert-mode list bindings (<C-D>/<C-T>/<C-L><C-?>)

Match upstream vimwiki's insert-mode list editing:
  <C-D>      list_change_level(-1)   dedent current item
  <C-T>      list_change_level(+1)   indent current item
  <C-L><C-J> list_cycle_symbol(+1)   cycle marker forward
  <C-L><C-K> list_cycle_symbol(-1)   cycle marker backward
  <C-L><C-M> list_toggle_or_add_chk  toggle if has checkbox, else add `[ ]`

Cycle order matches vimwiki's canonical run:
  - → * → # → 1. → 1) → a) → A) → i) → I) → (wrap)

Both Lua and VimL paths wired. Lua callbacks fire directly (no `<C-o>`
dance) since list_change_level / changeSymbol mutate the buffer via
the LSP applyEdit pipeline, which works cleanly in insert mode. VimL
keeps the `<C-o>:call …<CR>` idiom since that's the standard there.

Harness adds 5 cases covering the new insert-mode bindings plus one
direct LSP roundtrip for changeSymbol — surfaced a long-standing
stale-binary footgun in test-keymaps.sh (rebuilt only when bin was
missing; now rebuilds every run since incremental cargo is fast).
Harness also captures server log_messages and dumps them on failure
so future swallowed-error bugs (Err → log + Ok(None)) are visible.

Gates: 421 Rust / 25 Neovim / 12 Vim.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 21:11:53 +00:00
parent ee0309b3c2
commit 46ae618b5f
6 changed files with 208 additions and 7 deletions
+14
View File
@@ -240,6 +240,20 @@ function M.attach(bufnr, mappings)
{ desc = 'nuwiki: remove done items (whole doc)' }, bufnr)
map('n', 'o', open_below_with_bullet, { desc = 'nuwiki: open below + bullet' }, bufnr)
map('n', 'O', open_above_with_bullet, { desc = 'nuwiki: open above + bullet' }, bufnr)
-- Insert-mode bindings (matches upstream vimwiki). The list helpers
-- mutate the buffer via the LSP / `nvim_buf_set_lines`, both of
-- which work cleanly from insert mode, so no `<C-o>` dance needed.
map('i', '<C-D>', function() cmd.list_change_level(-1, false) end,
{ desc = 'nuwiki: list dedent (insert)' }, bufnr)
map('i', '<C-T>', function() cmd.list_change_level(1, false) end,
{ desc = 'nuwiki: list indent (insert)' }, bufnr)
map('i', '<C-L><C-J>', function() cmd.list_cycle_symbol(1) end,
{ desc = 'nuwiki: cycle list symbol (insert)' }, bufnr)
map('i', '<C-L><C-K>', function() cmd.list_cycle_symbol(-1) end,
{ desc = 'nuwiki: cycle list symbol backward (insert)' }, bufnr)
map('i', '<C-L><C-M>', cmd.list_toggle_or_add_checkbox,
{ desc = 'nuwiki: toggle/add checkbox (insert)' }, bufnr)
end
-- ===== Header levels + nav =====