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:
@@ -0,0 +1 @@
|
|||||||
|
{"sessionId":"26ea731a-0b5f-4222-9367-a179377ba451","pid":62425,"procStart":"58664295","acquiredAt":1780256801626}
|
||||||
@@ -632,6 +632,25 @@ unlet g:_nuwiki_target
|
|||||||
" follow_link_drop() request mechanism; its end-to-end coverage is the manual
|
" follow_link_drop() request mechanism; its end-to-end coverage is the manual
|
||||||
" development/start-vim.sh check.
|
" 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 =====
|
" ===== Wrap up =====
|
||||||
|
|
||||||
call add(s:results, '')
|
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)))
|
error('range toggle incomplete: ' .. vim.inspect(vim.api.nvim_buf_get_lines(0, 0, -1, false)))
|
||||||
end
|
end
|
||||||
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
|
-- `:VimwikiNormalizeLink 1` (the arg is upstream's visual flag; the command
|
||||||
-- is -nargs=? not -range, so no `'<,'>`) wraps the last visual selection.
|
-- is -nargs=? not -range, so no `'<,'>`) wraps the last visual selection.
|
||||||
tobj_case('cmd.normalize_link_visual_wraps_selection', function()
|
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`.
|
- [ ] `VimwikiReturn` — no Ex-command (mapping-driven only). _Fix:_ `ftplugin/vimwiki.vim`.
|
||||||
- [ ] `VimwikiTableAlignQ` vs `AlignW` collapsed to one `table_align` — `gqq`
|
- [ ] `VimwikiTableAlignQ` vs `AlignW` collapsed to one `table_align` — `gqq`
|
||||||
(align) vs `gww` (align w/o resize) distinction lost.
|
(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=+`.
|
- [ ] `VimwikiListChangeLvl` is `-nargs=?` vs upstream `-range -nargs=+`.
|
||||||
- [x] `VimwikiRebuildTags` `-bang` ("rebuild all") — `:…RebuildTags!` now passes
|
- [x] `VimwikiRebuildTags` `-bang` ("rebuild all") — `:…RebuildTags!` now passes
|
||||||
`{ all: true }`; the server (`tags_rebuild`) re-indexes **every** configured
|
`{ 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
|
- [ ] **Diary-note family lacks `-count`** _(new, 2026-05-31 re-audit)_ — upstream's
|
||||||
`:Vimwiki{Make,TabMake,MakeYesterday,MakeTomorrow}DiaryNote` carry `-count=0`
|
`:Vimwiki{Make,TabMake,MakeYesterday,MakeTomorrow}DiaryNote` carry `-count=0`
|
||||||
(the count selects the wiki number); nuwiki's diary-note commands declare no
|
(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 in either branch. _Fix:_ `ftplugin/vimwiki.vim` diary block (both
|
||||||
`-count=0`. _Fix:_ `ftplugin/vimwiki.vim` diary block (both branches) + thread
|
branches) + thread the count into `diary_today/yesterday/tomorrow` + server
|
||||||
the count into `diary_today/yesterday/tomorrow`.
|
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
|
- [ ] **No `-complete=` specs** _(new)_ — upstream attaches command-line completion
|
||||||
to `VimwikiGoto` (links), `VimwikiRenameFile` (files), `VimwikiColorize`
|
to `VimwikiGoto` (links), `VimwikiRenameFile` (files), `VimwikiColorize`
|
||||||
(colours), and the tag commands. nuwiki defines none, so `<Tab>` completion of
|
(colours), and the tag commands. nuwiki defines none, so `<Tab>` completion of
|
||||||
|
|||||||
+12
-12
@@ -45,8 +45,8 @@ if !has('nvim')
|
|||||||
" coc.nvim users can run `:CocCommand nuwiki.x` directly and skip
|
" coc.nvim users can run `:CocCommand nuwiki.x` directly and skip
|
||||||
" these aliases.
|
" these aliases.
|
||||||
|
|
||||||
command! -buffer -count VimwikiIndex call nuwiki#commands#wiki_index(<count>)
|
command! -buffer -count=0 VimwikiIndex call nuwiki#commands#wiki_index(<count>)
|
||||||
command! -buffer -count VimwikiTabIndex call nuwiki#commands#wiki_tab_index(<count>)
|
command! -buffer -count=0 VimwikiTabIndex call nuwiki#commands#wiki_tab_index(<count>)
|
||||||
command! -buffer VimwikiUISelect call nuwiki#commands#wiki_ui_select()
|
command! -buffer VimwikiUISelect call nuwiki#commands#wiki_ui_select()
|
||||||
command! -buffer VimwikiDiaryIndex call nuwiki#commands#diary_index()
|
command! -buffer VimwikiDiaryIndex call nuwiki#commands#diary_index()
|
||||||
command! -buffer VimwikiMakeDiaryNote call nuwiki#commands#diary_today()
|
command! -buffer VimwikiMakeDiaryNote call nuwiki#commands#diary_today()
|
||||||
@@ -110,7 +110,7 @@ if !has('nvim')
|
|||||||
command! -buffer -nargs=? VimwikiGenerateTags call nuwiki#commands#tags_generate_links(<q-args>)
|
command! -buffer -nargs=? VimwikiGenerateTags call nuwiki#commands#tags_generate_links(<q-args>)
|
||||||
|
|
||||||
" Tables, colorize, and clipboard paste.
|
" Tables, colorize, and clipboard paste.
|
||||||
command! -buffer -nargs=1 VimwikiTable call nuwiki#commands#table_insert()
|
command! -buffer -nargs=* VimwikiTable call nuwiki#commands#table_insert(<f-args>)
|
||||||
command! -buffer VimwikiTableMoveColumnLeft call nuwiki#commands#table_move_column_left()
|
command! -buffer VimwikiTableMoveColumnLeft call nuwiki#commands#table_move_column_left()
|
||||||
command! -buffer VimwikiTableMoveColumnRight call nuwiki#commands#table_move_column_right()
|
command! -buffer VimwikiTableMoveColumnRight call nuwiki#commands#table_move_column_right()
|
||||||
command! -buffer -nargs=* -range VimwikiColorize call nuwiki#commands#colorize(<q-args>, <range>)
|
command! -buffer -nargs=* -range VimwikiColorize call nuwiki#commands#colorize(<q-args>, <range>)
|
||||||
@@ -119,8 +119,8 @@ if !has('nvim')
|
|||||||
command! -buffer VimwikiCatUrl call nuwiki#commands#cat_url()
|
command! -buffer VimwikiCatUrl call nuwiki#commands#cat_url()
|
||||||
|
|
||||||
" :Nuwiki* canonical aliases — Vim side.
|
" :Nuwiki* canonical aliases — Vim side.
|
||||||
command! -buffer -count NuwikiIndex call nuwiki#commands#wiki_index(<count>)
|
command! -buffer -count=0 NuwikiIndex call nuwiki#commands#wiki_index(<count>)
|
||||||
command! -buffer -count NuwikiTabIndex call nuwiki#commands#wiki_tab_index(<count>)
|
command! -buffer -count=0 NuwikiTabIndex call nuwiki#commands#wiki_tab_index(<count>)
|
||||||
command! -buffer NuwikiUISelect call nuwiki#commands#wiki_ui_select()
|
command! -buffer NuwikiUISelect call nuwiki#commands#wiki_ui_select()
|
||||||
command! -buffer NuwikiDiaryIndex call nuwiki#commands#diary_index()
|
command! -buffer NuwikiDiaryIndex call nuwiki#commands#diary_index()
|
||||||
command! -buffer NuwikiDiaryToday call nuwiki#commands#diary_today()
|
command! -buffer NuwikiDiaryToday call nuwiki#commands#diary_today()
|
||||||
@@ -182,7 +182,7 @@ if !has('nvim')
|
|||||||
command! -buffer NuwikiRenumberList call nuwiki#commands#list_renumber()
|
command! -buffer NuwikiRenumberList call nuwiki#commands#list_renumber()
|
||||||
command! -buffer NuwikiRenumberAllLists call nuwiki#commands#list_renumber_all()
|
command! -buffer NuwikiRenumberAllLists call nuwiki#commands#list_renumber_all()
|
||||||
command! -buffer NuwikiTableAlign call nuwiki#commands#table_align()
|
command! -buffer NuwikiTableAlign call nuwiki#commands#table_align()
|
||||||
command! -buffer -nargs=1 NuwikiTable call nuwiki#commands#table_insert()
|
command! -buffer -nargs=* NuwikiTable call nuwiki#commands#table_insert(<f-args>)
|
||||||
command! -buffer NuwikiTableMoveColumnLeft call nuwiki#commands#table_move_column_left()
|
command! -buffer NuwikiTableMoveColumnLeft call nuwiki#commands#table_move_column_left()
|
||||||
command! -buffer NuwikiTableMoveColumnRight call nuwiki#commands#table_move_column_right()
|
command! -buffer NuwikiTableMoveColumnRight call nuwiki#commands#table_move_column_right()
|
||||||
command! -buffer -nargs=* -range NuwikiColorize call nuwiki#commands#colorize(<q-args>, <range>)
|
command! -buffer -nargs=* -range NuwikiColorize call nuwiki#commands#colorize(<q-args>, <range>)
|
||||||
@@ -391,8 +391,8 @@ endif
|
|||||||
" `nuwiki.commands` that either issues a `workspace/executeCommand`
|
" `nuwiki.commands` that either issues a `workspace/executeCommand`
|
||||||
" or, for client-side operations, calls `vim.lsp.buf.*` directly.
|
" or, for client-side operations, calls `vim.lsp.buf.*` directly.
|
||||||
|
|
||||||
command! -buffer -count VimwikiIndex lua require('nuwiki.commands').wiki_index(<count>)
|
command! -buffer -count=0 VimwikiIndex lua require('nuwiki.commands').wiki_index(<count>)
|
||||||
command! -buffer -count VimwikiTabIndex lua require('nuwiki.commands').wiki_tab_index(<count>)
|
command! -buffer -count=0 VimwikiTabIndex lua require('nuwiki.commands').wiki_tab_index(<count>)
|
||||||
command! -buffer VimwikiUISelect lua require('nuwiki.commands').wiki_ui_select()
|
command! -buffer VimwikiUISelect lua require('nuwiki.commands').wiki_ui_select()
|
||||||
command! -buffer VimwikiDiaryIndex lua require('nuwiki.commands').diary_index()
|
command! -buffer VimwikiDiaryIndex lua require('nuwiki.commands').diary_index()
|
||||||
command! -buffer VimwikiMakeDiaryNote lua require('nuwiki.commands').diary_today()
|
command! -buffer VimwikiMakeDiaryNote lua require('nuwiki.commands').diary_today()
|
||||||
@@ -458,7 +458,7 @@ command! -buffer -nargs=? VimwikiGenerateTagLinks lua require('nuwiki.commands'
|
|||||||
command! -buffer -nargs=? VimwikiGenerateTags lua require('nuwiki.commands').tags_generate_links(<q-args>)
|
command! -buffer -nargs=? VimwikiGenerateTags lua require('nuwiki.commands').tags_generate_links(<q-args>)
|
||||||
|
|
||||||
" Tables, colorize, and clipboard paste.
|
" Tables, colorize, and clipboard paste.
|
||||||
command! -buffer -nargs=1 VimwikiTable lua require('nuwiki.commands').table_insert()
|
command! -buffer -nargs=* VimwikiTable lua require('nuwiki.commands').table_insert(<f-args>)
|
||||||
command! -buffer VimwikiTableMoveColumnLeft lua require('nuwiki.commands').table_move_column_left()
|
command! -buffer VimwikiTableMoveColumnLeft lua require('nuwiki.commands').table_move_column_left()
|
||||||
command! -buffer VimwikiTableMoveColumnRight lua require('nuwiki.commands').table_move_column_right()
|
command! -buffer VimwikiTableMoveColumnRight lua require('nuwiki.commands').table_move_column_right()
|
||||||
command! -buffer -nargs=* -range VimwikiColorize lua require('nuwiki.commands').colorize(<q-args>, <range> > 0)
|
command! -buffer -nargs=* -range VimwikiColorize lua require('nuwiki.commands').colorize(<q-args>, <range> > 0)
|
||||||
@@ -467,8 +467,8 @@ command! -buffer VimwikiPasteUrl lua require('nuwiki.commands'
|
|||||||
command! -buffer VimwikiCatUrl lua require('nuwiki.commands').cat_url()
|
command! -buffer VimwikiCatUrl lua require('nuwiki.commands').cat_url()
|
||||||
|
|
||||||
" Canonical :Nuwiki* aliases — P10.
|
" Canonical :Nuwiki* aliases — P10.
|
||||||
command! -buffer -count NuwikiIndex lua require('nuwiki.commands').wiki_index(<count>)
|
command! -buffer -count=0 NuwikiIndex lua require('nuwiki.commands').wiki_index(<count>)
|
||||||
command! -buffer -count NuwikiTabIndex lua require('nuwiki.commands').wiki_tab_index(<count>)
|
command! -buffer -count=0 NuwikiTabIndex lua require('nuwiki.commands').wiki_tab_index(<count>)
|
||||||
command! -buffer NuwikiUISelect lua require('nuwiki.commands').wiki_ui_select()
|
command! -buffer NuwikiUISelect lua require('nuwiki.commands').wiki_ui_select()
|
||||||
command! -buffer NuwikiDiaryIndex lua require('nuwiki.commands').diary_index()
|
command! -buffer NuwikiDiaryIndex lua require('nuwiki.commands').diary_index()
|
||||||
command! -buffer NuwikiDiaryToday lua require('nuwiki.commands').diary_today()
|
command! -buffer NuwikiDiaryToday lua require('nuwiki.commands').diary_today()
|
||||||
@@ -530,7 +530,7 @@ command! -buffer -nargs=? NuwikiNormalizeLink lua require('nuwiki.command
|
|||||||
command! -buffer NuwikiRenumberList lua require('nuwiki.commands').list_renumber()
|
command! -buffer NuwikiRenumberList lua require('nuwiki.commands').list_renumber()
|
||||||
command! -buffer NuwikiRenumberAllLists lua require('nuwiki.commands').list_renumber_all()
|
command! -buffer NuwikiRenumberAllLists lua require('nuwiki.commands').list_renumber_all()
|
||||||
command! -buffer NuwikiTableAlign lua require('nuwiki.commands').table_align()
|
command! -buffer NuwikiTableAlign lua require('nuwiki.commands').table_align()
|
||||||
command! -buffer -nargs=1 NuwikiTable lua require('nuwiki.commands').table_insert()
|
command! -buffer -nargs=* NuwikiTable lua require('nuwiki.commands').table_insert(<f-args>)
|
||||||
command! -buffer NuwikiTableMoveColumnLeft lua require('nuwiki.commands').table_move_column_left()
|
command! -buffer NuwikiTableMoveColumnLeft lua require('nuwiki.commands').table_move_column_left()
|
||||||
command! -buffer NuwikiTableMoveColumnRight lua require('nuwiki.commands').table_move_column_right()
|
command! -buffer NuwikiTableMoveColumnRight lua require('nuwiki.commands').table_move_column_right()
|
||||||
command! -buffer -nargs=* -range NuwikiColorize lua require('nuwiki.commands').colorize(<q-args>, <range> > 0)
|
command! -buffer -nargs=* -range NuwikiColorize lua require('nuwiki.commands').colorize(<q-args>, <range> > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user