feat: real range/bang/visual handling for the deferred command gaps
CI / cargo fmt --check (push) Successful in 27s
CI / cargo clippy (push) Successful in 22s
CI / cargo test (push) Successful in 53s
CI / editor keymaps (push) Successful in 1m29s

Implements the four items previously left as "needs handler work" — all
fully wired, not cosmetic.

- ToggleListItem / IncrementListItem / DecrementListItem are now -range
  (both clients). The client loops the per-line op over [<line1>,<line2>]
  (toggle_list_item_range / list_cycle_symbol_range). The server's edits are
  version-less single-line WorkspaceEdits, so each line applies independently
  — no server protocol change. `:'<,'>VimwikiToggleListItem` toggles the whole
  selection.
- VimwikiRebuildTags gains -bang: `:…RebuildTags!` passes { all: true } and
  the server (tags_rebuild) re-indexes every configured wiki via
  wikis_snapshot(), not just the current one.
- VimwikiNormalizeLink is -nargs=?: with `1` (upstream's visual flag; the
  x-mode `+` mapping now passes it) it wraps the '< / '> selection as
  [[selection]] (new wrap_visual_as_wikilink in both clients).
- VimwikiCheckLinks is -range: a ranged invocation filters the broken-link
  report to the current buffer's selected lines (client-side filter in
  results_to_qf / check_links).

Tests: cmd.toggle_list_item_range + cmd.normalize_link_visual_wraps_selection
(test-keymaps.lua), normalize.visual_wraps_selection (test-keymaps-vim.vim).
README + doc/nuwiki.txt + gap doc updated. fmt/clippy clean; nvim 274,
vim 266+18, all Rust tests + config-parity green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 17:57:03 +00:00
parent 212b300fb4
commit db9c1c5c11
10 changed files with 297 additions and 105 deletions
+25 -25
View File
@@ -76,11 +76,11 @@ if !has('nvim')
command! -buffer VimwikiRenameFile call nuwiki#commands#rename_file()
command! -buffer VimwikiRenameLink call nuwiki#commands#rename_file()
command! -buffer VimwikiNextTask call nuwiki#commands#next_task()
command! -buffer VimwikiToggleListItem call nuwiki#commands#toggle_list_item()
command! -buffer -range VimwikiToggleListItem call nuwiki#commands#toggle_list_item_range(<line1>, <line2>)
command! -buffer VimwikiToggleRejectedListItem call nuwiki#commands#reject_list_item()
command! -buffer VimwikiListToggle call nuwiki#commands#list_toggle_or_add_checkbox()
command! -buffer VimwikiIncrementListItem call nuwiki#commands#list_cycle_symbol(1)
command! -buffer VimwikiDecrementListItem call nuwiki#commands#list_cycle_symbol(-1)
command! -buffer -range VimwikiIncrementListItem call nuwiki#commands#list_cycle_symbol_range(1, <line1>, <line2>)
command! -buffer -range VimwikiDecrementListItem call nuwiki#commands#list_cycle_symbol_range(-1, <line1>, <line2>)
command! -buffer -nargs=1 VimwikiChangeSymbolTo call nuwiki#commands#list_change_symbol(<q-args>, 0)
command! -buffer -nargs=1 VimwikiListChangeSymbolI call nuwiki#commands#list_change_symbol(<q-args>, 0)
command! -buffer -nargs=1 VimwikiChangeSymbolInListTo call nuwiki#commands#list_change_symbol(<q-args>, 1)
@@ -88,7 +88,7 @@ if !has('nvim')
command! -buffer -range VimwikiRemoveSingleCB call nuwiki#commands#list_remove_checkbox()
command! -buffer VimwikiRemoveCBInList call nuwiki#commands#list_remove_checkbox_in_list()
command! -buffer -nargs=? VimwikiListChangeLvl call nuwiki#commands#list_change_lvl()
command! -buffer VimwikiNormalizeLink call nuwiki#commands#normalize_link()
command! -buffer -nargs=? VimwikiNormalizeLink call nuwiki#commands#normalize_link(<args>)
command! -buffer VimwikiRenumberList call nuwiki#commands#list_renumber()
command! -buffer VimwikiRenumberAllLists call nuwiki#commands#list_renumber_all()
command! -buffer VimwikiTableAlignQ call nuwiki#commands#table_align()
@@ -101,10 +101,10 @@ if !has('nvim')
command! -buffer VimwikiTOC call nuwiki#commands#toc_generate()
command! -buffer VimwikiGenerateLinks call nuwiki#commands#links_generate()
command! -buffer VimwikiCheckLinks call nuwiki#commands#check_links()
command! -buffer -range VimwikiCheckLinks call nuwiki#commands#check_links(<range>, <line1>, <line2>)
command! -buffer VimwikiFindOrphans call nuwiki#commands#find_orphans()
command! -buffer VimwikiRebuildTags call nuwiki#commands#tags_rebuild()
command! -buffer -bang VimwikiRebuildTags call nuwiki#commands#tags_rebuild(<bang>0)
command! -buffer -nargs=? VimwikiSearchTags call nuwiki#commands#tags_search(<q-args>)
command! -buffer -nargs=? VimwikiGenerateTagLinks call nuwiki#commands#tags_generate_links(<q-args>)
command! -buffer -nargs=? VimwikiGenerateTags call nuwiki#commands#tags_generate_links(<q-args>)
@@ -137,7 +137,7 @@ if !has('nvim')
command! -buffer NuwikiDeleteFile call nuwiki#commands#delete_file()
command! -buffer NuwikiRenameFile call nuwiki#commands#rename_file()
command! -buffer NuwikiNextTask call nuwiki#commands#next_task()
command! -buffer NuwikiToggleListItem call nuwiki#commands#toggle_list_item()
command! -buffer -range NuwikiToggleListItem call nuwiki#commands#toggle_list_item_range(<line1>, <line2>)
command! -buffer NuwikiToggleRejected call nuwiki#commands#reject_list_item()
command! -buffer NuwikiExport call nuwiki#commands#export_current()
command! -buffer NuwikiExportBrowse call nuwiki#commands#export_browse()
@@ -145,9 +145,9 @@ if !has('nvim')
command! -buffer NuwikiRss call nuwiki#commands#export_rss()
command! -buffer NuwikiTOC call nuwiki#commands#toc_generate()
command! -buffer NuwikiGenerateLinks call nuwiki#commands#links_generate()
command! -buffer NuwikiCheckLinks call nuwiki#commands#check_links()
command! -buffer -range NuwikiCheckLinks call nuwiki#commands#check_links(<range>, <line1>, <line2>)
command! -buffer NuwikiFindOrphans call nuwiki#commands#find_orphans()
command! -buffer NuwikiRebuildTags call nuwiki#commands#tags_rebuild()
command! -buffer -bang NuwikiRebuildTags call nuwiki#commands#tags_rebuild(<bang>0)
command! -buffer -nargs=? NuwikiSearchTags call nuwiki#commands#tags_search(<q-args>)
command! -buffer -nargs=? NuwikiGenerateTagLinks call nuwiki#commands#tags_generate_links(<q-args>)
command! -buffer -nargs=1 NuwikiGoto call nuwiki#commands#wiki_goto_page(<q-args>)
@@ -173,11 +173,11 @@ if !has('nvim')
command! -buffer NuwikiRemoveCheckboxInList call nuwiki#commands#list_remove_checkbox_in_list()
command! -buffer -nargs=? NuwikiListChangeLvl call nuwiki#commands#list_change_lvl()
command! -buffer NuwikiListToggle call nuwiki#commands#list_toggle_or_add_checkbox()
command! -buffer NuwikiIncrementListItem call nuwiki#commands#list_cycle_symbol(1)
command! -buffer NuwikiDecrementListItem call nuwiki#commands#list_cycle_symbol(-1)
command! -buffer -range NuwikiIncrementListItem call nuwiki#commands#list_cycle_symbol_range(1, <line1>, <line2>)
command! -buffer -range NuwikiDecrementListItem call nuwiki#commands#list_cycle_symbol_range(-1, <line1>, <line2>)
command! -buffer -nargs=1 NuwikiChangeSymbol call nuwiki#commands#list_change_symbol(<q-args>, 0)
command! -buffer -nargs=1 NuwikiChangeSymbolInList call nuwiki#commands#list_change_symbol(<q-args>, 1)
command! -buffer NuwikiNormalizeLink call nuwiki#commands#normalize_link()
command! -buffer -nargs=? NuwikiNormalizeLink call nuwiki#commands#normalize_link(<args>)
command! -buffer NuwikiRenumberList call nuwiki#commands#list_renumber()
command! -buffer NuwikiRenumberAllLists call nuwiki#commands#list_renumber_all()
command! -buffer NuwikiTableAlign call nuwiki#commands#table_align()
@@ -223,7 +223,7 @@ if !has('nvim')
nnoremap <silent><buffer> <Tab> /\[\[<CR>:nohlsearch<CR>
nnoremap <silent><buffer> <S-Tab> ?\[\[<CR>:nohlsearch<CR>
nnoremap <silent><buffer> + :call nuwiki#commands#normalize_link()<CR>
xnoremap <silent><buffer> + :<C-u>call nuwiki#commands#normalize_link()<CR>
xnoremap <silent><buffer> + :<C-u>call nuwiki#commands#normalize_link(1)<CR>
nnoremap <silent><buffer> <Leader>wn :call nuwiki#commands#wiki_goto_page('')<CR>
nnoremap <silent><buffer> <Leader>wd :call nuwiki#commands#delete_file()<CR>
nnoremap <silent><buffer> <Leader>wr :call nuwiki#commands#rename_file()<CR>
@@ -417,11 +417,11 @@ command! -buffer VimwikiRenameFile lua require('nuwiki.commands').rename_
command! -buffer VimwikiRenameLink lua require('nuwiki.commands').rename_file()
command! -buffer VimwikiNextTask lua require('nuwiki.commands').next_task()
command! -buffer VimwikiToggleListItem lua require('nuwiki.commands').toggle_list_item()
command! -buffer -range VimwikiToggleListItem lua require('nuwiki.commands').toggle_list_item_range(<line1>, <line2>)
command! -buffer VimwikiToggleRejectedListItem lua require('nuwiki.commands').reject_list_item()
command! -buffer VimwikiListToggle lua require('nuwiki.commands').list_toggle_or_add_checkbox()
command! -buffer VimwikiIncrementListItem lua require('nuwiki.commands').list_cycle_symbol(1)
command! -buffer VimwikiDecrementListItem lua require('nuwiki.commands').list_cycle_symbol(-1)
command! -buffer -range VimwikiIncrementListItem lua require('nuwiki.commands').list_cycle_symbol_range(1, <line1>, <line2>)
command! -buffer -range VimwikiDecrementListItem lua require('nuwiki.commands').list_cycle_symbol_range(-1, <line1>, <line2>)
command! -buffer -nargs=1 VimwikiChangeSymbolTo lua require('nuwiki.commands').list_change_symbol(<q-args>, false)
command! -buffer -nargs=1 VimwikiListChangeSymbolI lua require('nuwiki.commands').list_change_symbol(<q-args>, false)
command! -buffer -nargs=1 VimwikiChangeSymbolInListTo lua require('nuwiki.commands').list_change_symbol(<q-args>, true)
@@ -429,7 +429,7 @@ command! -buffer -bang VimwikiRemoveDone lua require('nuwiki.command
command! -buffer -range VimwikiRemoveSingleCB lua require('nuwiki.commands').list_remove_checkbox()
command! -buffer VimwikiRemoveCBInList lua require('nuwiki.commands').list_remove_checkbox_in_list()
command! -buffer -nargs=? VimwikiListChangeLvl lua require('nuwiki.commands').list_change_lvl()
command! -buffer VimwikiNormalizeLink lua require('nuwiki.commands').normalize_link()
command! -buffer -nargs=? VimwikiNormalizeLink lua require('nuwiki.commands').normalize_link(<args>)
command! -buffer VimwikiRenumberList lua require('nuwiki.commands').list_renumber()
command! -buffer VimwikiRenumberAllLists lua require('nuwiki.commands').list_renumber_all()
command! -buffer VimwikiTableAlignQ lua require('nuwiki.commands').table_align()
@@ -442,10 +442,10 @@ command! -buffer VimwikiRss lua require('nuwiki.commands').export
command! -buffer VimwikiTOC lua require('nuwiki.commands').toc_generate()
command! -buffer VimwikiGenerateLinks lua require('nuwiki.commands').links_generate()
command! -buffer VimwikiCheckLinks lua require('nuwiki.commands').check_links()
command! -buffer -range VimwikiCheckLinks lua require('nuwiki.commands').check_links(<range>, <line1>, <line2>)
command! -buffer VimwikiFindOrphans lua require('nuwiki.commands').find_orphans()
command! -buffer VimwikiRebuildTags lua require('nuwiki.commands').tags_rebuild()
command! -buffer -bang VimwikiRebuildTags lua require('nuwiki.commands').tags_rebuild('<bang>' == '!')
command! -buffer -nargs=? VimwikiSearchTags lua require('nuwiki.commands').tags_search(<q-args>)
command! -buffer -nargs=? VimwikiGenerateTagLinks lua require('nuwiki.commands').tags_generate_links(<q-args>)
command! -buffer -nargs=? VimwikiGenerateTags lua require('nuwiki.commands').tags_generate_links(<q-args>)
@@ -475,7 +475,7 @@ command! -buffer NuwikiBacklinks lua vim.lsp.buf.references()
command! -buffer NuwikiDeleteFile lua require('nuwiki.commands').delete_file()
command! -buffer NuwikiRenameFile lua require('nuwiki.commands').rename_file()
command! -buffer NuwikiNextTask lua require('nuwiki.commands').next_task()
command! -buffer NuwikiToggleListItem lua require('nuwiki.commands').toggle_list_item()
command! -buffer -range NuwikiToggleListItem lua require('nuwiki.commands').toggle_list_item_range(<line1>, <line2>)
command! -buffer NuwikiToggleRejected lua require('nuwiki.commands').reject_list_item()
command! -buffer NuwikiExport lua require('nuwiki.commands').export_current()
command! -buffer NuwikiExportBrowse lua require('nuwiki.commands').export_browse()
@@ -483,9 +483,9 @@ command! -buffer -bang NuwikiExportAll execute (<bang>0 ? "lua require
command! -buffer NuwikiRss lua require('nuwiki.commands').export_rss()
command! -buffer NuwikiTOC lua require('nuwiki.commands').toc_generate()
command! -buffer NuwikiGenerateLinks lua require('nuwiki.commands').links_generate()
command! -buffer NuwikiCheckLinks lua require('nuwiki.commands').check_links()
command! -buffer -range NuwikiCheckLinks lua require('nuwiki.commands').check_links(<range>, <line1>, <line2>)
command! -buffer NuwikiFindOrphans lua require('nuwiki.commands').find_orphans()
command! -buffer NuwikiRebuildTags lua require('nuwiki.commands').tags_rebuild()
command! -buffer -bang NuwikiRebuildTags lua require('nuwiki.commands').tags_rebuild('<bang>' == '!')
command! -buffer -nargs=? NuwikiSearchTags lua require('nuwiki.commands').tags_search(<q-args>)
command! -buffer -nargs=? NuwikiGenerateTagLinks lua require('nuwiki.commands').tags_generate_links(<q-args>)
command! -buffer -nargs=1 NuwikiGoto lua require('nuwiki.commands').wiki_goto_page(<q-args>)
@@ -515,11 +515,11 @@ command! -buffer -range NuwikiRemoveCheckbox lua require('nuwiki.command
command! -buffer NuwikiRemoveCheckboxInList lua require('nuwiki.commands').list_remove_checkbox_in_list()
command! -buffer -nargs=? NuwikiListChangeLvl lua require('nuwiki.commands').list_change_lvl()
command! -buffer NuwikiListToggle lua require('nuwiki.commands').list_toggle_or_add_checkbox()
command! -buffer NuwikiIncrementListItem lua require('nuwiki.commands').list_cycle_symbol(1)
command! -buffer NuwikiDecrementListItem lua require('nuwiki.commands').list_cycle_symbol(-1)
command! -buffer -range NuwikiIncrementListItem lua require('nuwiki.commands').list_cycle_symbol_range(1, <line1>, <line2>)
command! -buffer -range NuwikiDecrementListItem lua require('nuwiki.commands').list_cycle_symbol_range(-1, <line1>, <line2>)
command! -buffer -nargs=1 NuwikiChangeSymbol lua require('nuwiki.commands').list_change_symbol(<q-args>, false)
command! -buffer -nargs=1 NuwikiChangeSymbolInList lua require('nuwiki.commands').list_change_symbol(<q-args>, true)
command! -buffer NuwikiNormalizeLink lua require('nuwiki.commands').normalize_link()
command! -buffer -nargs=? NuwikiNormalizeLink lua require('nuwiki.commands').normalize_link(<args>)
command! -buffer NuwikiRenumberList lua require('nuwiki.commands').list_renumber()
command! -buffer NuwikiRenumberAllLists lua require('nuwiki.commands').list_renumber_all()
command! -buffer NuwikiTableAlign lua require('nuwiki.commands').table_align()