fix(commands): route Neovim *Link Ex-commands through follow_link_or_create
Audit follow-up on the two link-path items flagged during the command-attribute pass: - REAL (bug #2): all eight Neovim Ex-command link defs (Vimwiki/Nuwiki × FollowLink/SplitLink/VSplitLink/TabnewLink) dispatched to raw `lua vim.lsp.buf.definition()`, bypassing the bare-word → [[link]] wrap + create-on-follow that the Vim commands and the Neovim <CR> family already do. All eight now call follow_link_or_create() (keeping their split/vsplit/tabnew prefixes). TabDropLink already used follow_link_drop and is unchanged. - FALSE ALARM (bug #1): the audit's claim that lua follow_link_or_create was "botched" (double definition() with dead pos_args code, no wrap) was a mis-read — it was a single correct definition that already wrapped bare words and is dispatched by <CR>. Tidied anyway: collapsed its two definition() call sites into one tail call; behaviour is identical (wrap still skipped when already inside a link, via short-circuit). Tests: cmd.VimwikiFollowLink_wraps_bare_word + cmd.VimwikiSplitLink_wraps_bare_word (test-keymaps.lua). Both harnesses green (lua 280, vim 269/18/21, 0 failed); gap doc corrected for both entries. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -403,11 +403,11 @@ command! -buffer VimwikiDiaryNextDay lua require('nuwiki.commands').dia
|
||||
command! -buffer VimwikiDiaryPrevDay lua require('nuwiki.commands').diary_prev()
|
||||
command! -buffer VimwikiDiaryGenerateLinks lua require('nuwiki.commands').diary_generate_index()
|
||||
|
||||
command! -buffer VimwikiFollowLink lua vim.lsp.buf.definition()
|
||||
command! -buffer VimwikiFollowLink lua require('nuwiki.commands').follow_link_or_create()
|
||||
command! -buffer VimwikiGoBackLink execute "normal! \<C-o>"
|
||||
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 -nargs=* VimwikiSplitLink split | lua require('nuwiki.commands').follow_link_or_create()
|
||||
command! -buffer -nargs=* VimwikiVSplitLink vsplit | lua require('nuwiki.commands').follow_link_or_create()
|
||||
command! -buffer VimwikiTabnewLink tabnew | lua require('nuwiki.commands').follow_link_or_create()
|
||||
command! -buffer VimwikiTabDropLink lua require('nuwiki.commands').follow_link_drop()
|
||||
command! -buffer VimwikiNextLink lua require('nuwiki.commands').link_next()
|
||||
command! -buffer VimwikiPrevLink lua require('nuwiki.commands').link_prev()
|
||||
@@ -477,7 +477,7 @@ command! -buffer NuwikiDiaryTomorrow lua require('nuwiki.commands').diar
|
||||
command! -buffer NuwikiDiaryNext lua require('nuwiki.commands').diary_next()
|
||||
command! -buffer NuwikiDiaryPrev lua require('nuwiki.commands').diary_prev()
|
||||
command! -buffer NuwikiDiaryGenerateLinks lua require('nuwiki.commands').diary_generate_index()
|
||||
command! -buffer NuwikiFollowLink lua vim.lsp.buf.definition()
|
||||
command! -buffer NuwikiFollowLink lua require('nuwiki.commands').follow_link_or_create()
|
||||
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()
|
||||
@@ -513,9 +513,9 @@ 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 -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 -nargs=* NuwikiSplitLink split | lua require('nuwiki.commands').follow_link_or_create()
|
||||
command! -buffer -nargs=* NuwikiVSplitLink vsplit | lua require('nuwiki.commands').follow_link_or_create()
|
||||
command! -buffer NuwikiTabnewLink tabnew | lua require('nuwiki.commands').follow_link_or_create()
|
||||
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 -range NuwikiRemoveCheckbox lua require('nuwiki.commands').list_remove_checkbox()
|
||||
|
||||
Reference in New Issue
Block a user