fix(parity): fifth-pass re-audit — VimwikiGoto nargs, autowriteall, table_auto_fmt
CI / cargo fmt --check (push) Successful in 26s
CI / cargo clippy (push) Successful in 37s
CI / cargo test (push) Successful in 40s
CI / editor keymaps (push) Successful in 1m35s

Closes the actionable fifth-pass findings (gap doc updated):

- VimwikiGoto / NuwikiGoto: -nargs=1 -> -nargs=* in all four defs. Was a
  real bug — `:VimwikiGoto` raised E471, `:VimwikiGoto My Page` raised E488,
  and the handler's empty-arg prompt fallback was unreachable. Both clients
  already prompt on empty, so -nargs=* (keeping -complete=pages) restores
  upstream behavior.

- autowriteall (upstream default ON): while a wiki buffer is current, mirror
  Vim's global 'autowriteall' (auto-save on page switch / :make), restoring
  the prior value on leave. Neovim via ftplugin.lua setup_autowriteall
  (BufEnter/BufLeave) gated by the `autowriteall` setup option; Vim via the
  NuwikiAutoWriteAll augroup gated by g:nuwiki_autowriteall.

- table_auto_fmt (upstream default ON): re-align the table under the cursor
  on InsertLeave. Both clients, gated by `table_auto_fmt` / g:nuwiki_table_auto_fmt,
  guarded on the cursor line containing `|` before the async table_align.

Also logged (no code): VimwikiRenameFile missing -nargs=? (subsumed by the
LSP-rename divergence), table_reduce_last_col, user_htmls, hl_headers/
hl_cb_checked, and a commentstring value-mismatch note. Mappings audit clean.

The Neovim harness disables table_auto_fmt in setup (its async re-align would
perturb the deterministic table-nav keystroke cases); its wiring is verified
on a throwaway scratch buffer instead. Docs (README + doc/nuwiki.txt) updated.
Tests: cmd.VimwikiGoto_accepts_multiword, config.autowriteall_applied,
config.table_auto_fmt_autocmd. Neovim 293, Vim 285/18/21 pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-03 00:59:33 +00:00
parent c161f9d21a
commit 3865b8bf0e
9 changed files with 239 additions and 7 deletions
+26
View File
@@ -692,6 +692,32 @@ call s:record(
\ 'cmd.search_and_tablealign_nargs',
\ 'err=' . s:attr_err)
" ===== :VimwikiGoto -nargs=* =====
" Was -nargs=1, so a page name with a space raised E488 (and the empty-arg
" prompt fallback was unreachable). Now -nargs=*: a multi-word arg must parse.
" The goto is an LSP roundtrip (no server here); swallow non-attribute errors.
let s:goto_err = ''
try
silent! VimwikiGoto My Page
catch /E471\|E488/
let s:goto_err = v:exception
catch
" no-LSP / not-found errors are expected and fine here.
endtry
call s:record(
\ s:goto_err ==# '' ? 1 : 0,
\ 'cmd.VimwikiGoto_accepts_multiword',
\ 'err=' . s:goto_err)
" ===== autowriteall / table_auto_fmt (Vim path) =====
" autowriteall (default on) sets Vim's global &autowriteall on the wiki buffer.
call s:record(&autowriteall ? 1 : 0, 'config.autowriteall_applied',
\ '&autowriteall=' . &autowriteall)
" table_auto_fmt (default on) registers the NuwikiTableAutoFmt InsertLeave group.
call s:record(exists('#NuwikiTableAutoFmt#InsertLeave') ? 1 : 0,
\ 'config.table_auto_fmt_autocmd',
\ exists('#NuwikiTableAutoFmt#InsertLeave') ? '' : 'no InsertLeave autocmd')
" ===== :VimwikiRemoveDone -bang -range =====
" Upstream is `-range`; nuwiki had `-bang` only, so `:'<,'>VimwikiRemoveDone`
" raised E481. Now `-bang -range`: a ranged invocation must parse (no E481),
+28
View File
@@ -255,6 +255,34 @@ vim.defer_fn(function()
end
end
-- ===== Config-driven buffer behaviors =====
-- autowriteall (default on) mirrors into Vim's global 'autowriteall' while
-- the wiki buffer is current.
record(vim.o.autowriteall == true, 'config.autowriteall_applied',
vim.o.autowriteall and '' or 'autowriteall not set on the wiki buffer')
-- table_auto_fmt wiring: with the option enabled, attaching a buffer
-- registers a buffer-local InsertLeave autocmd. (It's off in the harness
-- setup so the async re-align doesn't perturb the table-nav cases below, so
-- verify on a throwaway scratch buffer in its own window.)
do
local cfg = require('nuwiki.config')
cfg.options.table_auto_fmt = true
vim.cmd('new')
local sbuf = vim.api.nvim_get_current_buf()
require('nuwiki.ftplugin').attach(sbuf)
local found = false
for _, a in ipairs(vim.api.nvim_get_autocmds({ event = 'InsertLeave', buffer = sbuf })) do
if a.group_name and a.group_name:match('^nuwiki_taf_') then
found = true
break
end
end
record(found, 'config.table_auto_fmt_autocmd',
found and '' or 'attach did not register the InsertLeave autocmd when enabled')
cfg.options.table_auto_fmt = false
vim.cmd('bwipeout!')
end
-- ===== Lists =====
run('list.toggle_via_C-Space', {
+8 -2
View File
@@ -39,8 +39,14 @@ cat > "$INIT" <<EOF
vim.opt.runtimepath:prepend('$REPO_ROOT')
vim.g.nuwiki_binary_path = '$BIN'
-- Enable the opt-in mouse mappings so the harness can assert the full
-- documented mapping surface (doc §6 mouse group).
require('nuwiki').setup({ wiki_root = '$TMP/wiki', mappings = { mouse = true } })
-- documented mapping surface (doc §6 mouse group). table_auto_fmt is off here
-- so its async on-InsertLeave re-align doesn't perturb the deterministic
-- table-nav keystroke cases (its wiring is verified on a scratch buffer).
require('nuwiki').setup({
wiki_root = '$TMP/wiki',
mappings = { mouse = true },
table_auto_fmt = false,
})
EOF
RESULTS="$TMP/results.txt"
+64 -1
View File
@@ -172,6 +172,21 @@ fix site.
## P3 — Niche / low impact
### Commands
- [x] **`VimwikiGoto`/`NuwikiGoto` were `-nargs=1`** _(new, 2026-06-03 re-audit;
fixed same day)_ — upstream is `-nargs=*` (`ftplugin/vimwiki.vim:337`); nuwiki's
four defs were `-nargs=1`, so `:VimwikiGoto` (no arg) raised **E471** and
`:VimwikiGoto My Page` (spaced name) raised **E488** — and the handler's
empty-arg `input('Goto page: ')` prompt fallback was unreachable. _Fix:_ all
four defs (Vim+Neovim × `Vimwiki*`/`Nuwiki*`) are now `-nargs=*` (keeping
`-complete=…pages`); `<q-args>` joins a spaced name and an empty arg reaches
the prompt. Both handlers already prompt on empty. Covered by
`cmd.VimwikiGoto_accepts_multiword` (`test-keymaps-vim.vim`).
- [ ] **`VimwikiRenameFile` lacks `-nargs=?`** _(new, 2026-06-03 re-audit)_
upstream is `-nargs=? -complete=…file`; nuwiki's defs are bare, so
`:VimwikiRenameFile foo` raises E488. Subsumed by the existing "rename
delegates to the LSP rename request, takes no filename arg" divergence (the
`-complete=` item below) — adding `-nargs=?` (accepted-ignored) would restore
signature parity if desired. Low priority.
- [ ] `VimwikiVar` — config-var get/set introspection. _Fix:_ `plugin/nuwiki.vim`.
- [x] **`VimwikiShowVersion`** _(fixed 2026-06-03)_ — added global
`VimwikiShowVersion`/`NuwikiShowVersion` (both clients) echoing
@@ -400,6 +415,42 @@ fix site.
`cmd.VimwikiSplitLink_accepts_args` (`test-keymaps-vim.vim`, no E488).
### Config
- [x] **`autowriteall`** _(new, 2026-06-03 re-audit; fixed same day)_ — upstream
global (`vars.vim:136`, default **`1`/ON**): while a wiki buffer is current,
mirror Vim's global `'autowriteall'` (auto-save a modified buffer on page
switch / `:make`), restoring the prior value on leave (upstream
`plugin/vimwiki.vim:165-166,39`). nuwiki had no equivalent → out-of-box
behavioral divergence. _Fix:_ client-side, both clients — Neovim
`lua/nuwiki/ftplugin.lua` (`setup_autowriteall`, BufEnter/BufLeave save+set/
restore) gated by the `autowriteall` setup option (default true); Vim
`ftplugin/vimwiki.vim` (`NuwikiAutoWriteAll` augroup) gated by
`g:nuwiki_autowriteall` (default 1). Covered by `config.autowriteall_applied`
in both harnesses.
- [x] **`table_auto_fmt`** _(new, 2026-06-03 re-audit; fixed same day)_
upstream global (`vars.vim:183`, default **`1`/ON**): re-format the table under
the cursor on `InsertLeave` (upstream `plugin/vimwiki.vim:330`). nuwiki had no
equivalent (tables formatted only via `gqq`/`gww`). _Fix:_ client-side
`InsertLeave` autocmd, gated by config — Neovim `table_auto_fmt` setup option
(default true, `ftplugin.lua` `setup_table_auto_fmt`); Vim
`g:nuwiki_table_auto_fmt` (default 1, `NuwikiTableAutoFmt` augroup). Both guard
on the cursor line containing `|` before the (async LSP) `table_align`, so
non-table edits don't round-trip. Covered by `config.table_auto_fmt_autocmd`
in both harnesses. _(Divergence: nuwiki's `table_align` is an async server
edit, vs upstream's synchronous format — the result lands a beat after Esc.)_
- [ ] **`table_reduce_last_col`** _(new, 2026-06-03 re-audit)_ — upstream global
(`vars.vim:184`, default `0`): don't expand the last column separator to fill
the cell. nuwiki absent. Low impact (off by default). _Fix:_ thread a flag into
the table-format routine.
- [ ] **`user_htmls`** _(new, 2026-06-03 re-audit)_ — upstream global
(`vars.vim:191`, default `''`): comma-separated HTML files with no wiki source
that `:VimwikiAll2HTML` must not delete. nuwiki absent — only relevant if
nuwiki's all-to-HTML prunes orphan HTML (it may not, in which case this is moot
and worth a one-line divergence note rather than code).
- [ ] **`hl_headers` / `hl_cb_checked`** _(new, 2026-06-03 re-audit)_ — upstream
globals (`vars.vim:158`/`157`, both default `0`): per-level header highlight /
checked-checkbox line highlight. nuwiki absent. Borderline — either implement
via highlight groups/semantic tokens, or fold into the `conceal*`/`maxhi`
highlighting-divergence family so future audits stop flagging them.
- [x] **`list_margin` — buffer-side parity + markdown default** _(new,
2026-06-02 re-audit; fixed 2026-06-02)_ — upstream (`vars.vim:516`, doc
`vimwiki.txt:2667`): left-margin **width in spaces for buffer-side generated
@@ -449,7 +500,9 @@ fix site.
- [ ] `dir_link` — index file to open when following a directory link.
- [ ] `auto_chdir``:cd` into wiki root on open (client-side).
- [ ] `bullet_types` / `cycle_bullets` — custom bullet glyphs + wrap-around.
- [ ] `commentstring` (`'%%%s'`) — comment toggling/text-objects.
- [ ] `commentstring` (`'%%%s'`) — comment toggling/text-objects. _(2026-06-03
re-audit: also a value mismatch — nuwiki hardcodes `%% %s` (with a space) in
`ftplugin/vimwiki.vim:18` vs upstream's no-space `%%%s`; align when picked up.)_
- [ ] `color_tag_template``color_dic` present; template regex missing.
Related divergence _(2026-05-31 config re-audit)_: nuwiki's `color_dic`
defaults to **empty** while upstream ships a populated palette
@@ -608,3 +661,13 @@ audits don't re-flag them.
of the documented "generated-content is vimwiki-only" divergence. All five
P1-blocking sections remain clear; only niche P3 items (and the deferred
markdown work) are left.
- Re-audited 2026-06-03 (fifth pass — commands / config / mappings, three
parallel agents) against vimwiki `a54a300` (still no upstream commits since
2026-04-30). **Mappings: clean** again (confirmed `gLH/gLL/gLR` correct; no new
gaps, no regressions). **Commands:** one real bug — `VimwikiGoto`/`NuwikiGoto`
were `-nargs=1` (E471/E488 + unreachable prompt), fixed same day; plus
`VimwikiRenameFile`'s missing `-nargs=?` logged (subsumed by the LSP-rename
divergence). **Config:** five new items — `autowriteall` and `table_auto_fmt`
(both ON upstream → out-of-box divergences, implemented same day),
`table_reduce_last_col`, `user_htmls`, `hl_headers`/`hl_cb_checked` logged; and
a `commentstring` value-mismatch note. No previously-closed item regressed.