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', {
|
||||
|
||||
Reference in New Issue
Block a user