feat(parity): close the entire P3 Commands section
All six remaining command gaps (client-side; no server change):
- VimwikiRenameFile: bare -> -nargs=? (arg accepted-ignored; rename still
delegates to the LSP rename prompt). No more E488.
- VimwikiVar / NuwikiVar: get/set the client config (upstream vimwiki#vars#cmd).
No arg prints config (Vim: g:nuwiki_*; Neovim: resolved setup() opts), one arg
gets a key, two+ sets it. Global command, both clients.
- VimwikiReturn / NuwikiReturn: command form of the smart <CR> continuation —
enters insert at EOL and fires the <CR> mapping (return_cmd / vimwiki_return).
Upstream's mode-flag args accepted but unused.
- VimwikiTableAlignQ vs AlignW: corrected — upstream's gqq/gww are identical on
a table; the only difference is the non-table fallback (native `normal! gqq`
vs `gww`). New table_align_or_cmd(cmd) aligns on a table row, else runs
`normal! <cmd>`. Q/gqq/gq1 -> gqq; W/gww/gw1 -> gww; NuwikiTableAlign -> gqq.
- VimwikiSearch / VWS: scope the lvimgrep to the current wiki's root (resolved
client-side) over <root>/**/*<ext>, not CWD `**`; empty pattern reuses the
last search. Both clients.
- VimwikiIndex family: add global Vimwiki/NuwikiIndex + TabIndex entry points
(plugin/nuwiki.vim + init.lua _setup_global_commands, with -count), so a wiki
opens from any buffer. Buffer-local copies still shadow inside wiki buffers.
Tests: surface.{Vimwiki,Nuwiki}{Return,Var}, cmd.VimwikiVar_sets_*,
cmd.global_entry_points (both harnesses). Docs (README + doc/nuwiki.txt) and the
gap doc updated. Neovim 299, Vim 291/18/21 pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -112,7 +112,7 @@ let s:both_forms = [
|
||||
\ 'RebuildTags', '2HTML', '2HTMLBrowse', 'All2HTML', 'Rss',
|
||||
\ 'NormalizeLink', 'RenumberList', 'RenumberAllLists',
|
||||
\ 'ListToggle', 'IncrementListItem', 'DecrementListItem',
|
||||
\ 'CatUrl', 'ShowVersion',
|
||||
\ 'CatUrl', 'ShowVersion', 'Return', 'Var',
|
||||
\ ]
|
||||
for s:suffix in s:both_forms
|
||||
for s:prefix in ['Nuwiki', 'Vimwiki']
|
||||
@@ -709,6 +709,24 @@ call s:record(
|
||||
\ 'cmd.VimwikiGoto_accepts_multiword',
|
||||
\ 'err=' . s:goto_err)
|
||||
|
||||
" ===== :VimwikiVar get/set =====
|
||||
" `:VimwikiVar key val` sets g:nuwiki_<key>; bare/get forms just echo.
|
||||
silent VimwikiVar testkey hello world
|
||||
call s:record(get(g:, 'nuwiki_testkey', '') ==# 'hello world' ? 1 : 0,
|
||||
\ 'cmd.VimwikiVar_sets_global',
|
||||
\ 'g:nuwiki_testkey=' . get(g:, 'nuwiki_testkey', '(unset)'))
|
||||
|
||||
" ===== global entry points work outside a wiki buffer =====
|
||||
" Index / TabIndex / Var / ShowVersion are defined globally (upstream defines
|
||||
" the Index family in plugin/). Open a throwaway non-wiki buffer and confirm.
|
||||
new
|
||||
setlocal buftype=nofile
|
||||
let s:glob_ok = exists(':VimwikiIndex') == 2 && exists(':VimwikiTabIndex') == 2
|
||||
\ && exists(':VimwikiVar') == 2 && exists(':VimwikiShowVersion') == 2
|
||||
call s:record(s:glob_ok ? 1 : 0, 'cmd.global_entry_points',
|
||||
\ 'Index/TabIndex/Var/ShowVersion visible outside a wiki buffer')
|
||||
bwipeout!
|
||||
|
||||
" ===== 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',
|
||||
|
||||
@@ -139,7 +139,7 @@ vim.defer_fn(function()
|
||||
'RebuildTags', '2HTML', '2HTMLBrowse', 'All2HTML', 'Rss',
|
||||
'NormalizeLink', 'RenumberList', 'RenumberAllLists',
|
||||
'ListToggle', 'IncrementListItem', 'DecrementListItem',
|
||||
'CatUrl', 'ShowVersion',
|
||||
'CatUrl', 'ShowVersion', 'Return', 'Var',
|
||||
}
|
||||
for _, suffix in ipairs(both_forms) do
|
||||
for _, prefix in ipairs({ 'Nuwiki', 'Vimwiki' }) do
|
||||
@@ -283,6 +283,27 @@ vim.defer_fn(function()
|
||||
vim.cmd('bwipeout!')
|
||||
end
|
||||
|
||||
-- :VimwikiVar key val sets the in-memory option.
|
||||
do
|
||||
vim.cmd('VimwikiVar testkey hello')
|
||||
local v = require('nuwiki.config').options.testkey
|
||||
record(v == 'hello', 'cmd.VimwikiVar_sets_option', 'options.testkey=' .. tostring(v))
|
||||
end
|
||||
|
||||
-- Index / TabIndex / Var / ShowVersion are global (work outside a wiki
|
||||
-- buffer). Open a throwaway scratch buffer and confirm they're visible.
|
||||
do
|
||||
vim.cmd('enew')
|
||||
vim.bo.buftype = 'nofile'
|
||||
local ok = vim.fn.exists(':VimwikiIndex') == 2
|
||||
and vim.fn.exists(':VimwikiTabIndex') == 2
|
||||
and vim.fn.exists(':VimwikiVar') == 2
|
||||
and vim.fn.exists(':VimwikiShowVersion') == 2
|
||||
record(ok, 'cmd.global_entry_points',
|
||||
ok and '' or 'a global command is not visible outside a wiki buffer')
|
||||
vim.cmd('bwipeout!')
|
||||
end
|
||||
|
||||
-- ===== Lists =====
|
||||
|
||||
run('list.toggle_via_C-Space', {
|
||||
|
||||
+58
-25
@@ -181,27 +181,43 @@ fix site.
|
||||
`-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] **`VimwikiRenameFile` `-nargs=?`** _(new, 2026-06-03 re-audit; fixed
|
||||
2026-06-03)_ — upstream is `-nargs=? -complete=…file`; nuwiki's defs were bare,
|
||||
so `:VimwikiRenameFile foo` raised E488. _Fix:_ all four defs are now
|
||||
`-nargs=?` (arg accepted-and-ignored — rename still delegates to the LSP rename
|
||||
request, which drives its own prompt). No more E488.
|
||||
- [x] **`VimwikiVar`/`NuwikiVar`** _(fixed 2026-06-03)_ — config-var get/set
|
||||
introspection (upstream `vimwiki#vars#cmd`). _Fix:_ global command in both
|
||||
clients — no arg prints the client config (Vim: every `g:nuwiki_*`; Neovim: the
|
||||
resolved `setup()` options), one arg gets a key, two+ sets it (server-backed
|
||||
settings need a restart, which the echo notes). `nuwiki#commands#var` /
|
||||
`commands.var`. Covered by `cmd.VimwikiVar_sets_global` (vim) /
|
||||
`cmd.VimwikiVar_sets_option` (nvim) + `surface.{Vimwiki,Nuwiki}Var`.
|
||||
- [x] **`VimwikiShowVersion`** _(fixed 2026-06-03)_ — added global
|
||||
`VimwikiShowVersion`/`NuwikiShowVersion` (both clients) echoing
|
||||
`g:nuwiki_version` (`0.1.0`) + the host editor, via
|
||||
`nuwiki#commands#show_version` / `commands.show_version`. Covered by
|
||||
`surface.{Vimwiki,Nuwiki}ShowVersion` in both keymap harnesses.
|
||||
- [ ] `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 still lost (the remaining
|
||||
open part). _(Re-audit 2026-05-31: also the attr differed — bare vs upstream's
|
||||
`-nargs=?`, so `:VimwikiTableAlignQ 2` raised E488.)_ _Attr part fixed
|
||||
2026-06-03:_ `VimwikiTableAlignQ`/`AlignW` + `NuwikiTableAlign` are now
|
||||
`-nargs=?` in all contexts (the optional column arg is accepted-and-ignored
|
||||
pending the align-vs-resize split), so the E488 is gone. Covered by
|
||||
`cmd.search_and_tablealign_nargs` (`test-keymaps-vim.vim`).
|
||||
- [x] **`VimwikiReturn`/`NuwikiReturn`** _(fixed 2026-06-03)_ — upstream exposes
|
||||
the smart-`<CR>` continuation as a command; nuwiki had it only as the
|
||||
insert-mode `<expr>` mapping. _Fix:_ buffer-local `-nargs=*` command in both
|
||||
clients that enters insert at EOL and triggers the same `<CR>` mapping
|
||||
(`return_cmd` / `vimwiki_return`), continuing the list item / table row.
|
||||
Upstream's mode-flag args are accepted but unused (continuation is inferred
|
||||
from the line). Covered by `surface.{Vimwiki,Nuwiki}Return`.
|
||||
- [x] **`VimwikiTableAlignQ` vs `AlignW`** _(fixed 2026-06-03; earlier framing
|
||||
corrected)_ — the earlier note ("`gqq` align vs `gww` align-without-resize")
|
||||
mis-read upstream: `vimwiki#tbl#align_or_cmd('gqq'|'gww')` calls the **same**
|
||||
`vimwiki#tbl#format` when on a table — the only difference is the **non-table
|
||||
fallback** (`normal! gqq` vs `normal! gww`, native paragraph-format; `gw` keeps
|
||||
the cursor put). nuwiki had both unconditionally call `table_align`, so off a
|
||||
table they did nothing. _Fix:_ a shared `table_align_or_cmd(cmd)` (both clients)
|
||||
aligns when on a table row, else runs `normal! <cmd>` — `gqq`/`gq1` +
|
||||
`VimwikiTableAlignQ` → `gqq`; `gww`/`gw1` + `VimwikiTableAlignW` → `gww`;
|
||||
`NuwikiTableAlign` → `gqq`. (The `-nargs=?` attribute + the partial-column `2`
|
||||
arg, accepted-and-ignored, are unchanged; true partial-column align stays a
|
||||
separate deeper table feature.) Covered by `cmd.search_and_tablealign_nargs`
|
||||
(`test-keymaps-vim.vim`) + the table alignment cases that still route through it.
|
||||
- [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
|
||||
@@ -247,13 +263,16 @@ fix site.
|
||||
`{ all: true }`; the server (`tags_rebuild`) re-indexes **every** configured
|
||||
wiki (via `wikis_snapshot()`) instead of just the current one. `-bang` added to
|
||||
all four command defs.
|
||||
- [ ] `:VimwikiSearch` / `VWS` uses `lvimgrep`, not vimwiki's search engine
|
||||
(the remaining open part — a deliberate, simpler implementation). _(Re-audit
|
||||
2026-05-31: also `-nargs=1` vs upstream `-nargs=*`.)_ _Attr part fixed
|
||||
2026-06-03:_ both are now `-nargs=*` (Vim + Neovim), so a multi-word
|
||||
`:VimwikiSearch foo bar` no longer raises E488 and an empty `:VimwikiSearch`
|
||||
reuses the last search pattern (`lvimgrep //`). Covered by
|
||||
`cmd.search_and_tablealign_nargs` (`test-keymaps-vim.vim`).
|
||||
- [x] **`:VimwikiSearch` / `VWS` now scope to the wiki** _(fixed 2026-06-03)_ —
|
||||
upstream's search runs over the wiki's files, not the editor's CWD; nuwiki's
|
||||
`lvimgrep /<args>/ **` searched CWD-relative `**`. _Fix:_ both commands route
|
||||
through `nuwiki#commands#search` / `commands.search` (both clients), which
|
||||
resolves the wiki whose root contains the current file (else the first
|
||||
configured wiki, else CWD) and `lvimgrep`s `<root>/**/*<ext>` into the location
|
||||
list; an empty pattern reuses the last search (`@/`). The `-nargs=*` attr fix
|
||||
(2026-06-03) is folded in. _(nuwiki uses Vim's `lvimgrep` rather than a bespoke
|
||||
engine — the same mechanism vimwiki uses — so this is full behavioral parity.)_
|
||||
Covered by `cmd.search_and_tablealign_nargs` (`test-keymaps-vim.vim`).
|
||||
- [x] **`VimwikiChangeSymbolTo` / `VimwikiListChangeSymbolI` lack `-range`**
|
||||
_(new, 2026-05-31 re-audit; fixed same day)_ — upstream both carry
|
||||
`-range -nargs=1`; nuwiki had `-nargs=1` only, so a visual-range invocation
|
||||
@@ -279,8 +298,15 @@ fix site.
|
||||
day)_ — added `NuwikiGenerateTags` (Vim + Neovim) mirroring
|
||||
`VimwikiGenerateTags` → `tags_generate_links`, with `-nargs=?` +
|
||||
`-complete=…tags`. Covered by `cmd.NuwikiGenerateTags_exists` (both harnesses).
|
||||
- [ ] `VimwikiIndex` family is buffer-local in nuwiki (upstream defines globally
|
||||
in `plugin/`); only `:…UISelect` is a global entry point.
|
||||
- [x] **`VimwikiIndex` family now has global entry points** _(fixed 2026-06-03)_
|
||||
— upstream defines the Index family in `plugin/`; nuwiki had `Index`/`TabIndex`
|
||||
only buffer-local (so a wiki couldn't be opened from a non-wiki buffer; only
|
||||
`:…UISelect`/`:…ShowVersion` were global). _Fix:_ global
|
||||
`Vimwiki/NuwikiIndex` + `Vimwiki/NuwikiTabIndex` (with `-count` for the wiki
|
||||
number) added in `plugin/nuwiki.vim` (Vim) and `init.lua`
|
||||
`_setup_global_commands` (Neovim), dispatching to the existing
|
||||
`wiki_index`/`wiki_tab_index`. The buffer-local copies still shadow them inside
|
||||
wiki buffers. Covered by `cmd.global_entry_points` in both harnesses.
|
||||
- [x] **`VimwikiColorize` / `NuwikiColorize` drop their argument in the Neovim
|
||||
branch** — both are `-nargs=1`, but the Neovim defs called `colorize()` with no
|
||||
`<q-args>` (`ftplugin/vimwiki.vim:445,517`) while the Vim branch passes it. The
|
||||
@@ -671,3 +697,10 @@ audits don't re-flag them.
|
||||
(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.
|
||||
- Cleared the **entire P3 Commands section** (2026-06-03): `VimwikiRenameFile`
|
||||
`-nargs=?`; `VimwikiVar`/`NuwikiVar` (get/set client config); `VimwikiReturn`/
|
||||
`NuwikiReturn` (command form of smart-`<CR>`); the `TableAlignQ` vs `AlignW`
|
||||
split (corrected — the real difference is the non-table `normal! gqq`/`gww`
|
||||
fallback, now via `table_align_or_cmd`); `:VimwikiSearch`/`VWS` scoped to the
|
||||
wiki root; and global `Index`/`TabIndex` entry points. All client-side (no
|
||||
server change). Both harnesses green (Neovim 299, Vim 291/18/21).
|
||||
|
||||
Reference in New Issue
Block a user