fix(search): graceful no-match + NuwikiSearch alias (re-audit follow-up)
CI / cargo fmt --check (push) Successful in 28s
CI / cargo clippy (push) Successful in 29s
CI / cargo test (push) Successful in 35s
CI / editor keymaps (push) Successful in 1m25s

Re-audit of the just-landed command work found one real bug I introduced
and a convention gap:

- VimwikiSearch / VWS raised a raw E480 on a no-match search; upstream
  reports it gracefully. Both clients now catch it (try/catch in Vim,
  pcall in Neovim) and emit "nuwiki: no match for <pat>".

- Added a NuwikiSearch alias alongside VimwikiSearch/VWS (every other
  command carries a Nuwiki* form).

Gap-doc note corrected: nuwiki's search populates + opens the location
list (shows all matches) where upstream jumps to the first match — logged
as a minor presentation divergence rather than claiming exact parity.

Config + mappings re-audits came back clean (no new gaps, no regressions;
table-mapping rewire verified non-recursive, gLH/gLL/gLR present).

Tests: cmd.VimwikiSearch_no_match_graceful, surface.{Vimwiki,Nuwiki}Search.
Neovim 301, Vim 294/18/21 pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-03 01:28:44 +00:00
parent a11b742fc1
commit 6deba47106
6 changed files with 35 additions and 8 deletions
+5 -1
View File
@@ -314,7 +314,11 @@ function M.search(args)
end
if not ext:match('^%.') then ext = '.' .. ext end
local glob = root == '' and '**' or (vim.fn.fnameescape(root) .. '**/*' .. ext)
vim.cmd('lvimgrep /' .. vim.fn.escape(pat, '/') .. '/j ' .. glob)
local ok = pcall(vim.cmd, 'lvimgrep /' .. vim.fn.escape(pat, '/') .. '/j ' .. glob)
if not ok then
vim.notify('nuwiki: no match for ' .. pat, vim.log.levels.WARN)
return
end
vim.cmd('lopen')
end