feat(commands): VimwikiSplitLink/VSplitLink -nargs=* signature parity (P3)
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:
@@ -669,6 +669,26 @@ call s:record(
|
|||||||
\ 'cmd.VimwikiListChangeLvl_accepts_range_and_args',
|
\ 'cmd.VimwikiListChangeLvl_accepts_range_and_args',
|
||||||
\ 'err=' . s:lcl_err)
|
\ 'err=' . s:lcl_err)
|
||||||
|
|
||||||
|
" ===== :VimwikiSplitLink -nargs=* =====
|
||||||
|
" Upstream takes optional reuse/move-cursor flags; nuwiki's defs took none, so
|
||||||
|
" `:VimwikiSplitLink 0 1` raised E488. Now -nargs=*: assert the arg parse
|
||||||
|
" succeeds. The split opens a window (the follow itself is an LSP no-op here);
|
||||||
|
" collapse back to one window afterward.
|
||||||
|
call s:set_buf(['[[Target]]'])
|
||||||
|
let s:sl_err = ''
|
||||||
|
try
|
||||||
|
silent VimwikiSplitLink 0 1
|
||||||
|
catch /E488/
|
||||||
|
let s:sl_err = v:exception
|
||||||
|
catch
|
||||||
|
" non-E488 (e.g. no LSP attached) is expected and fine here.
|
||||||
|
endtry
|
||||||
|
silent! only
|
||||||
|
call s:record(
|
||||||
|
\ s:sl_err ==# '' ? 1 : 0,
|
||||||
|
\ 'cmd.VimwikiSplitLink_accepts_args',
|
||||||
|
\ 'err=' . s:sl_err)
|
||||||
|
|
||||||
" ===== Wrap up =====
|
" ===== Wrap up =====
|
||||||
|
|
||||||
call add(s:results, '')
|
call add(s:results, '')
|
||||||
|
|||||||
@@ -267,12 +267,20 @@ fix site.
|
|||||||
(bare `:VimwikiColorize` prompts). Covered by
|
(bare `:VimwikiColorize` prompts). Covered by
|
||||||
`normalize.visual_wraps_selection` (vim) /
|
`normalize.visual_wraps_selection` (vim) /
|
||||||
`cmd.normalize_link_visual_wraps_selection` (nvim).
|
`cmd.normalize_link_visual_wraps_selection` (nvim).
|
||||||
- [ ] **`VimwikiSplitLink` / `VimwikiVSplitLink` lack `-nargs=*`** _(new,
|
- [x] **`VimwikiSplitLink` / `VimwikiVSplitLink` lack `-nargs=*`** _(new,
|
||||||
2026-05-31 third re-audit)_ — upstream both take an optional target link to
|
2026-05-31 third re-audit; corrected during the 2026-05-31 command-attribute
|
||||||
follow in the split; nuwiki's defs (both branches) take no args, so you can't
|
pass)_ — the earlier note was wrong: upstream's optional args are NOT a target
|
||||||
pass a link to the split-follow. Low impact (the arg path is rarely used).
|
link but `reuse_other_split_window` (a:1) and `move_cursor` (a:2) — the link
|
||||||
_Fix:_ `ftplugin/vimwiki.vim` both branches + thread a target through
|
is always the one under the cursor (`vimwiki#base#follow_link`). nuwiki's defs
|
||||||
`follow_link_or_create`.
|
took no args, so `:VimwikiSplitLink 0 1` (upstream muscle memory / migrated
|
||||||
|
scripts) raised E488. _Fix:_ all eight defs (both clients × Split/VSplit ×
|
||||||
|
Vimwiki/Nuwiki) are now `-nargs=*`, restoring signature parity. **Divergence
|
||||||
|
(documented):** the two flags are *accepted but not acted on* — nuwiki always
|
||||||
|
opens a fresh split and follows in it, because the follow is an async LSP
|
||||||
|
jump and honoring `move_cursor`/`reuse` would require threading a completion
|
||||||
|
callback through that path (disproportionate for this rarely-used arg form;
|
||||||
|
the no-arg case — the 99% path — is fully equivalent). Covered by
|
||||||
|
`cmd.VimwikiSplitLink_accepts_args` (`test-keymaps-vim.vim`, no E488).
|
||||||
|
|
||||||
### Config
|
### Config
|
||||||
- [ ] `auto_header` — auto H1-from-filename on new page (server-side).
|
- [ ] `auto_header` — auto H1-from-filename on new page (server-side).
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ if !has('nvim')
|
|||||||
command! -buffer VimwikiDiaryPrevDay call nuwiki#commands#diary_prev()
|
command! -buffer VimwikiDiaryPrevDay call nuwiki#commands#diary_prev()
|
||||||
command! -buffer VimwikiDiaryGenerateLinks call nuwiki#commands#diary_generate_index()
|
command! -buffer VimwikiDiaryGenerateLinks call nuwiki#commands#diary_generate_index()
|
||||||
command! -buffer VimwikiFollowLink call nuwiki#commands#follow_link_or_create()
|
command! -buffer VimwikiFollowLink call nuwiki#commands#follow_link_or_create()
|
||||||
command! -buffer VimwikiSplitLink split | call nuwiki#commands#follow_link_or_create()
|
command! -buffer -nargs=* VimwikiSplitLink split | call nuwiki#commands#follow_link_or_create()
|
||||||
command! -buffer VimwikiVSplitLink vsplit | 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 VimwikiTabnewLink tabnew | call nuwiki#commands#follow_link_or_create()
|
||||||
command! -buffer VimwikiTabDropLink call nuwiki#commands#follow_link_drop()
|
command! -buffer VimwikiTabDropLink call nuwiki#commands#follow_link_drop()
|
||||||
command! -buffer VimwikiGoBackLink execute "normal! \<C-o>"
|
command! -buffer VimwikiGoBackLink execute "normal! \<C-o>"
|
||||||
@@ -129,8 +129,8 @@ if !has('nvim')
|
|||||||
command! -buffer NuwikiDiaryNext call nuwiki#commands#diary_next()
|
command! -buffer NuwikiDiaryNext call nuwiki#commands#diary_next()
|
||||||
command! -buffer NuwikiDiaryPrev call nuwiki#commands#diary_prev()
|
command! -buffer NuwikiDiaryPrev call nuwiki#commands#diary_prev()
|
||||||
command! -buffer NuwikiFollowLink call nuwiki#commands#follow_link_or_create()
|
command! -buffer NuwikiFollowLink call nuwiki#commands#follow_link_or_create()
|
||||||
command! -buffer NuwikiSplitLink split | call nuwiki#commands#follow_link_or_create()
|
command! -buffer -nargs=* NuwikiSplitLink split | call nuwiki#commands#follow_link_or_create()
|
||||||
command! -buffer NuwikiVSplitLink vsplit | 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 NuwikiTabnewLink tabnew | call nuwiki#commands#follow_link_or_create()
|
||||||
command! -buffer NuwikiTabDropLink call nuwiki#commands#follow_link_drop()
|
command! -buffer NuwikiTabDropLink call nuwiki#commands#follow_link_drop()
|
||||||
command! -buffer NuwikiGoBackLink execute "normal! \<C-o>"
|
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 VimwikiFollowLink lua vim.lsp.buf.definition()
|
||||||
command! -buffer VimwikiGoBackLink execute "normal! \<C-o>"
|
command! -buffer VimwikiGoBackLink execute "normal! \<C-o>"
|
||||||
command! -buffer VimwikiSplitLink split | lua vim.lsp.buf.definition()
|
command! -buffer -nargs=* VimwikiSplitLink split | lua vim.lsp.buf.definition()
|
||||||
command! -buffer VimwikiVSplitLink vsplit | 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 VimwikiTabnewLink tabnew | lua vim.lsp.buf.definition()
|
||||||
command! -buffer VimwikiTabDropLink lua require('nuwiki.commands').follow_link_drop()
|
command! -buffer VimwikiTabDropLink lua require('nuwiki.commands').follow_link_drop()
|
||||||
command! -buffer VimwikiNextLink lua require('nuwiki.commands').link_next()
|
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 -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 NuwikiGoBackLink execute "normal! \<C-o>"
|
||||||
command! -buffer NuwikiSplitLink split | lua vim.lsp.buf.definition()
|
command! -buffer -nargs=* NuwikiSplitLink split | lua vim.lsp.buf.definition()
|
||||||
command! -buffer NuwikiVSplitLink vsplit | 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 NuwikiTabnewLink tabnew | lua vim.lsp.buf.definition()
|
||||||
command! -buffer NuwikiTabDropLink lua require('nuwiki.commands').follow_link_drop()
|
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']()
|
command! -buffer -bang NuwikiRemoveDone lua require('nuwiki.commands')[('<bang>' == '!') and 'list_remove_done_all' or 'list_remove_done']()
|
||||||
|
|||||||
Reference in New Issue
Block a user