fix(parity): fifth-pass re-audit — VimwikiGoto nargs, autowriteall, table_auto_fmt
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:
+31
-4
@@ -37,6 +37,33 @@ augroup END
|
||||
call nuwiki#colors#refresh()
|
||||
let b:undo_ftplugin .= ' | execute "autocmd! NuwikiColorConceal * <buffer>"'
|
||||
|
||||
" vimwiki `autowriteall` / `table_auto_fmt` (Vim path; Neovim wires both via
|
||||
" lua/nuwiki/ftplugin.lua). autowriteall mirrors the option into Vim's global
|
||||
" &autowriteall while a wiki buffer is current (auto-save on switch/make),
|
||||
" restoring the prior value on leave. table_auto_fmt re-aligns the table under
|
||||
" the cursor on InsertLeave. Disable with g:nuwiki_autowriteall /
|
||||
" g:nuwiki_table_auto_fmt = 0.
|
||||
if !has('nvim')
|
||||
if get(g:, 'nuwiki_autowriteall', 1)
|
||||
augroup NuwikiAutoWriteAll
|
||||
autocmd! * <buffer>
|
||||
autocmd BufEnter <buffer> let s:nuwiki_awa_saved = &autowriteall | let &autowriteall = 1
|
||||
autocmd BufLeave <buffer> let &autowriteall = get(s:, 'nuwiki_awa_saved', &autowriteall)
|
||||
augroup END
|
||||
" FileType fires after the initial BufEnter, so apply once now too.
|
||||
let s:nuwiki_awa_saved = &autowriteall
|
||||
let &autowriteall = 1
|
||||
let b:undo_ftplugin .= ' | execute "autocmd! NuwikiAutoWriteAll * <buffer>"'
|
||||
endif
|
||||
if get(g:, 'nuwiki_table_auto_fmt', 1)
|
||||
augroup NuwikiTableAutoFmt
|
||||
autocmd! * <buffer>
|
||||
autocmd InsertLeave <buffer> if getline('.') =~# '|' | call nuwiki#commands#table_align() | endif
|
||||
augroup END
|
||||
let b:undo_ftplugin .= ' | execute "autocmd! NuwikiTableAutoFmt * <buffer>"'
|
||||
endif
|
||||
endif
|
||||
|
||||
if !has('nvim')
|
||||
" ===== Plain Vim path =====
|
||||
"
|
||||
@@ -69,7 +96,7 @@ if !has('nvim')
|
||||
command! -buffer VimwikiBaddLink call nuwiki#commands#badd_link()
|
||||
command! -buffer -nargs=* VimwikiSearch lvimgrep /<args>/ **
|
||||
command! -buffer -nargs=* VWS lvimgrep /<args>/ **
|
||||
command! -buffer -nargs=1 -complete=customlist,nuwiki#complete#pages VimwikiGoto call nuwiki#commands#wiki_goto_page(<q-args>)
|
||||
command! -buffer -nargs=* -complete=customlist,nuwiki#complete#pages VimwikiGoto call nuwiki#commands#wiki_goto_page(<q-args>)
|
||||
|
||||
command! -buffer VimwikiDeleteFile call nuwiki#commands#delete_file()
|
||||
command! -buffer VimwikiDeleteLink call nuwiki#commands#delete_file()
|
||||
@@ -152,7 +179,7 @@ if !has('nvim')
|
||||
command! -buffer -nargs=? -complete=customlist,nuwiki#complete#tags NuwikiSearchTags call nuwiki#commands#tags_search(<q-args>)
|
||||
command! -buffer -nargs=? -complete=customlist,nuwiki#complete#tags NuwikiGenerateTagLinks call nuwiki#commands#tags_generate_links(<q-args>)
|
||||
command! -buffer -nargs=? -complete=customlist,nuwiki#complete#tags NuwikiGenerateTags call nuwiki#commands#tags_generate_links(<q-args>)
|
||||
command! -buffer -nargs=1 -complete=customlist,nuwiki#complete#pages NuwikiGoto call nuwiki#commands#wiki_goto_page(<q-args>)
|
||||
command! -buffer -nargs=* -complete=customlist,nuwiki#complete#pages NuwikiGoto call nuwiki#commands#wiki_goto_page(<q-args>)
|
||||
|
||||
" Canonical :Nuwiki* names that mirror the documented surface.
|
||||
" The older :Nuwiki* spellings above stay defined for back-compat.
|
||||
@@ -417,7 +444,7 @@ command! -buffer VimwikiTabDropLink lua require('nuwiki.commands').follow
|
||||
command! -buffer VimwikiNextLink lua require('nuwiki.commands').link_next()
|
||||
command! -buffer VimwikiPrevLink lua require('nuwiki.commands').link_prev()
|
||||
command! -buffer VimwikiBaddLink lua require('nuwiki.commands').badd_link()
|
||||
command! -buffer -nargs=1 -complete=customlist,nuwiki#complete#pages VimwikiGoto lua require('nuwiki.commands').wiki_goto_page(<q-args>)
|
||||
command! -buffer -nargs=* -complete=customlist,nuwiki#complete#pages VimwikiGoto lua require('nuwiki.commands').wiki_goto_page(<q-args>)
|
||||
command! -buffer VimwikiBacklinks lua vim.lsp.buf.references()
|
||||
command! -buffer VWB lua vim.lsp.buf.references()
|
||||
command! -buffer -nargs=* VimwikiSearch lvimgrep /<args>/ **
|
||||
@@ -501,7 +528,7 @@ command! -buffer -bang NuwikiRebuildTags lua require('nuwiki.comma
|
||||
command! -buffer -nargs=? -complete=customlist,nuwiki#complete#tags NuwikiSearchTags lua require('nuwiki.commands').tags_search(<q-args>)
|
||||
command! -buffer -nargs=? -complete=customlist,nuwiki#complete#tags NuwikiGenerateTagLinks lua require('nuwiki.commands').tags_generate_links(<q-args>)
|
||||
command! -buffer -nargs=? -complete=customlist,nuwiki#complete#tags NuwikiGenerateTags lua require('nuwiki.commands').tags_generate_links(<q-args>)
|
||||
command! -buffer -nargs=1 -complete=customlist,nuwiki#complete#pages NuwikiGoto lua require('nuwiki.commands').wiki_goto_page(<q-args>)
|
||||
command! -buffer -nargs=* -complete=customlist,nuwiki#complete#pages NuwikiGoto lua require('nuwiki.commands').wiki_goto_page(<q-args>)
|
||||
|
||||
" Canonical :Nuwiki* names that mirror the documented surface.
|
||||
" The older :Nuwiki* spellings above stay defined for back-compat.
|
||||
|
||||
Reference in New Issue
Block a user