feat(commands): VimwikiSplitLink/VSplitLink -nargs=* signature parity (P3)
CI / cargo fmt --check (push) Successful in 22s
CI / cargo clippy (push) Successful in 26s
CI / cargo test (push) Successful in 1m5s
CI / editor keymaps (push) Successful in 1m35s

Upstream's :Vimwiki[V]SplitLink take optional reuse_other_split_window +
move_cursor flags (the link is always the one under the cursor); nuwiki's defs
took no args, so `:VimwikiSplitLink 0 1` raised E488. All eight defs (both
clients × Split/VSplit × Vimwiki/Nuwiki) are now -nargs=*, restoring signature
parity for migrated configs/scripts.

Documented divergence: the two flags are accepted but not acted on — nuwiki
always opens a fresh split and follows in it. Honoring move_cursor/reuse would
require threading a completion callback through the async LSP follow path,
disproportionate for this rarely-used arg form; the no-arg path (99% case) is
fully equivalent. The gap-doc note (which wrongly described the args as a
"target link") is corrected.

Test: cmd.VimwikiSplitLink_accepts_args (test-keymaps-vim.vim, no E488).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 20:20:43 +00:00
parent 4710ba03c8
commit acaaf107b4
3 changed files with 42 additions and 14 deletions
+8 -8
View File
@@ -57,8 +57,8 @@ if !has('nvim')
command! -buffer VimwikiDiaryPrevDay call nuwiki#commands#diary_prev()
command! -buffer VimwikiDiaryGenerateLinks call nuwiki#commands#diary_generate_index()
command! -buffer VimwikiFollowLink call nuwiki#commands#follow_link_or_create()
command! -buffer VimwikiSplitLink split | call nuwiki#commands#follow_link_or_create()
command! -buffer VimwikiVSplitLink vsplit | call nuwiki#commands#follow_link_or_create()
command! -buffer -nargs=* VimwikiSplitLink split | call nuwiki#commands#follow_link_or_create()
command! -buffer -nargs=* VimwikiVSplitLink vsplit | call nuwiki#commands#follow_link_or_create()
command! -buffer VimwikiTabnewLink tabnew | call nuwiki#commands#follow_link_or_create()
command! -buffer VimwikiTabDropLink call nuwiki#commands#follow_link_drop()
command! -buffer VimwikiGoBackLink execute "normal! \<C-o>"
@@ -129,8 +129,8 @@ if !has('nvim')
command! -buffer NuwikiDiaryNext call nuwiki#commands#diary_next()
command! -buffer NuwikiDiaryPrev call nuwiki#commands#diary_prev()
command! -buffer NuwikiFollowLink call nuwiki#commands#follow_link_or_create()
command! -buffer NuwikiSplitLink split | call nuwiki#commands#follow_link_or_create()
command! -buffer NuwikiVSplitLink vsplit | call nuwiki#commands#follow_link_or_create()
command! -buffer -nargs=* NuwikiSplitLink split | call nuwiki#commands#follow_link_or_create()
command! -buffer -nargs=* NuwikiVSplitLink vsplit | call nuwiki#commands#follow_link_or_create()
command! -buffer NuwikiTabnewLink tabnew | call nuwiki#commands#follow_link_or_create()
command! -buffer NuwikiTabDropLink call nuwiki#commands#follow_link_drop()
command! -buffer NuwikiGoBackLink execute "normal! \<C-o>"
@@ -405,8 +405,8 @@ command! -buffer VimwikiDiaryGenerateLinks lua require('nuwiki.commands')
command! -buffer VimwikiFollowLink lua vim.lsp.buf.definition()
command! -buffer VimwikiGoBackLink execute "normal! \<C-o>"
command! -buffer VimwikiSplitLink split | lua vim.lsp.buf.definition()
command! -buffer VimwikiVSplitLink vsplit | lua vim.lsp.buf.definition()
command! -buffer -nargs=* VimwikiSplitLink split | lua vim.lsp.buf.definition()
command! -buffer -nargs=* VimwikiVSplitLink vsplit | lua vim.lsp.buf.definition()
command! -buffer VimwikiTabnewLink tabnew | lua vim.lsp.buf.definition()
command! -buffer VimwikiTabDropLink lua require('nuwiki.commands').follow_link_drop()
command! -buffer VimwikiNextLink lua require('nuwiki.commands').link_next()
@@ -513,8 +513,8 @@ command! -buffer Nuwiki2HTMLBrowse lua require('nuwiki.command
command! -buffer -bang NuwikiAll2HTML execute (<bang>0 ? "lua require('nuwiki.commands').export_all_force()" : "lua require('nuwiki.commands').export_all()")
command! -buffer NuwikiGoBackLink execute "normal! \<C-o>"
command! -buffer NuwikiSplitLink split | lua vim.lsp.buf.definition()
command! -buffer NuwikiVSplitLink vsplit | lua vim.lsp.buf.definition()
command! -buffer -nargs=* NuwikiSplitLink split | lua vim.lsp.buf.definition()
command! -buffer -nargs=* NuwikiVSplitLink vsplit | lua vim.lsp.buf.definition()
command! -buffer NuwikiTabnewLink tabnew | lua vim.lsp.buf.definition()
command! -buffer NuwikiTabDropLink lua require('nuwiki.commands').follow_link_drop()
command! -buffer -bang NuwikiRemoveDone lua require('nuwiki.commands')[('<bang>' == '!') and 'list_remove_done_all' or 'list_remove_done']()