diff --git a/.claude/scheduled_tasks.lock b/.claude/scheduled_tasks.lock new file mode 100644 index 0000000..6680032 --- /dev/null +++ b/.claude/scheduled_tasks.lock @@ -0,0 +1 @@ +{"sessionId":"26ea731a-0b5f-4222-9367-a179377ba451","pid":62425,"procStart":"58664295","acquiredAt":1780256801626} \ No newline at end of file diff --git a/development/tests/test-keymaps-vim.vim b/development/tests/test-keymaps-vim.vim index 338b095..6542f88 100644 --- a/development/tests/test-keymaps-vim.vim +++ b/development/tests/test-keymaps-vim.vim @@ -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, '') diff --git a/development/tests/test-keymaps.lua b/development/tests/test-keymaps.lua index 10a7766..da28837 100644 --- a/development/tests/test-keymaps.lua +++ b/development/tests/test-keymaps.lua @@ -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() diff --git a/development/vimwiki-gap.md b/development/vimwiki-gap.md index a6594f7..27880db 100644 --- a/development/vimwiki-gap.md +++ b/development/vimwiki-gap.md @@ -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 `` 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 `` completion of diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 9b8eb5a..3f6c7ad 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -45,8 +45,8 @@ if !has('nvim') " coc.nvim users can run `:CocCommand nuwiki.x` directly and skip " these aliases. - command! -buffer -count VimwikiIndex call nuwiki#commands#wiki_index() - command! -buffer -count VimwikiTabIndex call nuwiki#commands#wiki_tab_index() + command! -buffer -count=0 VimwikiIndex call nuwiki#commands#wiki_index() + command! -buffer -count=0 VimwikiTabIndex call nuwiki#commands#wiki_tab_index() command! -buffer VimwikiUISelect call nuwiki#commands#wiki_ui_select() command! -buffer VimwikiDiaryIndex call nuwiki#commands#diary_index() 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() " Tables, colorize, and clipboard paste. - command! -buffer -nargs=1 VimwikiTable call nuwiki#commands#table_insert() + command! -buffer -nargs=* VimwikiTable call nuwiki#commands#table_insert() command! -buffer VimwikiTableMoveColumnLeft call nuwiki#commands#table_move_column_left() command! -buffer VimwikiTableMoveColumnRight call nuwiki#commands#table_move_column_right() command! -buffer -nargs=* -range VimwikiColorize call nuwiki#commands#colorize(, ) @@ -119,8 +119,8 @@ if !has('nvim') command! -buffer VimwikiCatUrl call nuwiki#commands#cat_url() " :Nuwiki* canonical aliases — Vim side. - command! -buffer -count NuwikiIndex call nuwiki#commands#wiki_index() - command! -buffer -count NuwikiTabIndex call nuwiki#commands#wiki_tab_index() + command! -buffer -count=0 NuwikiIndex call nuwiki#commands#wiki_index() + command! -buffer -count=0 NuwikiTabIndex call nuwiki#commands#wiki_tab_index() command! -buffer NuwikiUISelect call nuwiki#commands#wiki_ui_select() command! -buffer NuwikiDiaryIndex call nuwiki#commands#diary_index() 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 NuwikiRenumberAllLists call nuwiki#commands#list_renumber_all() 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() command! -buffer NuwikiTableMoveColumnLeft call nuwiki#commands#table_move_column_left() command! -buffer NuwikiTableMoveColumnRight call nuwiki#commands#table_move_column_right() command! -buffer -nargs=* -range NuwikiColorize call nuwiki#commands#colorize(, ) @@ -391,8 +391,8 @@ endif " `nuwiki.commands` that either issues a `workspace/executeCommand` " or, for client-side operations, calls `vim.lsp.buf.*` directly. -command! -buffer -count VimwikiIndex lua require('nuwiki.commands').wiki_index() -command! -buffer -count VimwikiTabIndex lua require('nuwiki.commands').wiki_tab_index() +command! -buffer -count=0 VimwikiIndex lua require('nuwiki.commands').wiki_index() +command! -buffer -count=0 VimwikiTabIndex lua require('nuwiki.commands').wiki_tab_index() command! -buffer VimwikiUISelect lua require('nuwiki.commands').wiki_ui_select() command! -buffer VimwikiDiaryIndex lua require('nuwiki.commands').diary_index() 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() " 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() command! -buffer VimwikiTableMoveColumnLeft lua require('nuwiki.commands').table_move_column_left() command! -buffer VimwikiTableMoveColumnRight lua require('nuwiki.commands').table_move_column_right() command! -buffer -nargs=* -range VimwikiColorize lua require('nuwiki.commands').colorize(, > 0) @@ -467,8 +467,8 @@ command! -buffer VimwikiPasteUrl lua require('nuwiki.commands' command! -buffer VimwikiCatUrl lua require('nuwiki.commands').cat_url() " Canonical :Nuwiki* aliases — P10. -command! -buffer -count NuwikiIndex lua require('nuwiki.commands').wiki_index() -command! -buffer -count NuwikiTabIndex lua require('nuwiki.commands').wiki_tab_index() +command! -buffer -count=0 NuwikiIndex lua require('nuwiki.commands').wiki_index() +command! -buffer -count=0 NuwikiTabIndex lua require('nuwiki.commands').wiki_tab_index() command! -buffer NuwikiUISelect lua require('nuwiki.commands').wiki_ui_select() command! -buffer NuwikiDiaryIndex lua require('nuwiki.commands').diary_index() 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 NuwikiRenumberAllLists lua require('nuwiki.commands').list_renumber_all() 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() command! -buffer NuwikiTableMoveColumnLeft lua require('nuwiki.commands').table_move_column_left() command! -buffer NuwikiTableMoveColumnRight lua require('nuwiki.commands').table_move_column_right() command! -buffer -nargs=* -range NuwikiColorize lua require('nuwiki.commands').colorize(, > 0)