fix(search): graceful no-match + NuwikiSearch alias (re-audit follow-up)
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:
@@ -205,7 +205,12 @@ function! nuwiki#commands#search(args) abort
|
||||
endif
|
||||
let l:ext = l:ext[0] ==# '.' ? l:ext : '.' . l:ext
|
||||
let l:glob = l:root ==# '' ? '**' : fnameescape(l:root) . '**/*' . l:ext
|
||||
execute 'lvimgrep /' . escape(l:pat, '/') . '/j ' . l:glob
|
||||
try
|
||||
execute 'lvimgrep /' . escape(l:pat, '/') . '/j ' . l:glob
|
||||
catch /E480/
|
||||
echohl WarningMsg | echom 'nuwiki: no match for ' . l:pat | echohl None
|
||||
return
|
||||
endtry
|
||||
lopen
|
||||
endfunction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user