feat(commands): VimwikiTable -nargs=* + Index/TabIndex -count=0 (P3 parity)
Two command-attribute parity fixes (audited against upstream vimwiki master): - VimwikiTable / NuwikiTable were -nargs=1 and called table_insert() with no args, so `:VimwikiTable 4 3` raised E488 and cols/rows were unreachable. All four defs (Vim+Neovim × Vimwiki+Nuwiki) are now -nargs=* and forward <f-args>; the backing table_insert already parsed cols (a:1) + rows (a:2). - VimwikiIndex/TabIndex (and Nuwiki forms) switch from bare -count to upstream's -count=0. Behavior is unchanged (both default count to 0; wiki_index already maps a count to the 1-indexed wiki number) — this just matches the upstream declaration exactly. Tests: cmd.VimwikiTable_passes_cols_and_rows (test-keymaps.lua — asserts a 4-col/3-row table) and cmd.VimwikiTable_accepts_cols_rows (test-keymaps-vim.vim — no E488). gap doc updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -632,6 +632,25 @@ unlet g:_nuwiki_target
|
||||
" follow_link_drop() request mechanism; its end-to-end coverage is the manual
|
||||
" development/start-vim.sh check.
|
||||
|
||||
" ===== :VimwikiTable -nargs=* (cols+rows) =====
|
||||
" Was -nargs=1, which raised E488 on `:VimwikiTable 4 3`. The table insert
|
||||
" itself is an LSP roundtrip (no server in this headless harness), so we only
|
||||
" assert the arg parse succeeds — i.e. no E488 trailing-characters error.
|
||||
call s:set_buf([''])
|
||||
call cursor(1, 1)
|
||||
let s:tbl_err = ''
|
||||
try
|
||||
silent VimwikiTable 4 3
|
||||
catch /E488/
|
||||
let s:tbl_err = v:exception
|
||||
catch
|
||||
" A non-E488 error (e.g. no LSP attached) is expected and fine here.
|
||||
endtry
|
||||
call s:record(
|
||||
\ s:tbl_err ==# '' ? 1 : 0,
|
||||
\ 'cmd.VimwikiTable_accepts_cols_rows',
|
||||
\ 'err=' . s:tbl_err)
|
||||
|
||||
" ===== Wrap up =====
|
||||
|
||||
call add(s:results, '')
|
||||
|
||||
@@ -808,6 +808,32 @@ vim.defer_fn(function()
|
||||
error('range toggle incomplete: ' .. vim.inspect(vim.api.nvim_buf_get_lines(0, 0, -1, false)))
|
||||
end
|
||||
end)
|
||||
-- `:VimwikiTable {cols} [rows]` — now -nargs=* (was -nargs=1, which dropped
|
||||
-- the args entirely). A 4-col table has 5 pipes per row; 3 data rows give
|
||||
-- header + separator + 3 = 5 table lines.
|
||||
tobj_case('cmd.VimwikiTable_passes_cols_and_rows', function()
|
||||
set_buf({ '' })
|
||||
vim.api.nvim_win_set_cursor(0, { 1, 0 })
|
||||
vim.cmd('VimwikiTable 4 3')
|
||||
local tbl = {}
|
||||
local done = vim.wait(2000, function()
|
||||
tbl = {}
|
||||
for _, l in ipairs(vim.api.nvim_buf_get_lines(0, 0, -1, false)) do
|
||||
if l:find('|', 1, true) then tbl[#tbl + 1] = l end
|
||||
end
|
||||
return #tbl >= 5
|
||||
end, 30)
|
||||
if not done then
|
||||
error('table not inserted: ' .. vim.inspect(vim.api.nvim_buf_get_lines(0, 0, -1, false)))
|
||||
end
|
||||
local pipes = select(2, tbl[1]:gsub('|', ''))
|
||||
if pipes ~= 5 then
|
||||
error('want 4 cols (5 pipes), got ' .. pipes .. ': ' .. tbl[1])
|
||||
end
|
||||
if #tbl ~= 5 then
|
||||
error('want 5 table lines (hdr+sep+3 rows), got ' .. #tbl)
|
||||
end
|
||||
end)
|
||||
-- `:VimwikiNormalizeLink 1` (the arg is upstream's visual flag; the command
|
||||
-- is -nargs=? not -range, so no `'<,'>`) wraps the last visual selection.
|
||||
tobj_case('cmd.normalize_link_visual_wraps_selection', function()
|
||||
|
||||
@@ -177,7 +177,12 @@ fix site.
|
||||
- [ ] `VimwikiReturn` — no Ex-command (mapping-driven only). _Fix:_ `ftplugin/vimwiki.vim`.
|
||||
- [ ] `VimwikiTableAlignQ` vs `AlignW` collapsed to one `table_align` — `gqq`
|
||||
(align) vs `gww` (align w/o resize) distinction lost.
|
||||
- [ ] `VimwikiTable` is `-nargs=1` vs upstream `-nargs=*` (can't pass cols+rows).
|
||||
- [x] `VimwikiTable` was `-nargs=1` vs upstream `-nargs=*` (couldn't pass
|
||||
cols+rows). _Fix:_ all four defs (Vim+Neovim × Vimwiki+Nuwiki) are now
|
||||
`-nargs=*` and forward `<f-args>` to `table_insert` (which already parsed
|
||||
cols/rows). Covered by `cmd.VimwikiTable_passes_cols_and_rows`
|
||||
(`test-keymaps.lua`, asserts a `:VimwikiTable 4 3` → 4-col, 3-row table) and
|
||||
`cmd.VimwikiTable_accepts_cols_rows` (`test-keymaps-vim.vim`, no E488).
|
||||
- [ ] `VimwikiListChangeLvl` is `-nargs=?` vs upstream `-range -nargs=+`.
|
||||
- [x] `VimwikiRebuildTags` `-bang` ("rebuild all") — `:…RebuildTags!` now passes
|
||||
`{ all: true }`; the server (`tags_rebuild`) re-indexes **every** configured
|
||||
@@ -235,9 +240,12 @@ fix site.
|
||||
- [ ] **Diary-note family lacks `-count`** _(new, 2026-05-31 re-audit)_ — upstream's
|
||||
`:Vimwiki{Make,TabMake,MakeYesterday,MakeTomorrow}DiaryNote` carry `-count=0`
|
||||
(the count selects the wiki number); nuwiki's diary-note commands declare no
|
||||
count in either branch, and `Index`/`TabIndex` use bare `-count` vs upstream
|
||||
`-count=0`. _Fix:_ `ftplugin/vimwiki.vim` diary block (both branches) + thread
|
||||
the count into `diary_today/yesterday/tomorrow`.
|
||||
count in either branch. _Fix:_ `ftplugin/vimwiki.vim` diary block (both
|
||||
branches) + thread the count into `diary_today/yesterday/tomorrow` + server
|
||||
diary commands (accept an optional `wiki` selector). _(The `Index`/`TabIndex`
|
||||
half is done: all four defs now use upstream's `-count=0` instead of bare
|
||||
`-count`; `wiki_index`/`wiki_tab_index` already map the count to the wiki
|
||||
number.)_
|
||||
- [ ] **No `-complete=` specs** _(new)_ — upstream attaches command-line completion
|
||||
to `VimwikiGoto` (links), `VimwikiRenameFile` (files), `VimwikiColorize`
|
||||
(colours), and the tag commands. nuwiki defines none, so `<Tab>` completion of
|
||||
|
||||
Reference in New Issue
Block a user