feat(diary): -count wiki selector for diary-note + index commands (P3)
Closes the last command-cluster gap. Upstream's diary-note family
(:Vimwiki{Make,TabMake,MakeYesterday,MakeTomorrow}DiaryNote + VimwikiDiaryIndex,
and the Nuwiki* forms) carry -count=0 where the count selects the wiki number;
nuwiki's were bare. Implemented as a real end-to-end selector, reusing existing
infrastructure:
- Server (commands.rs): OptUriArg gained an optional `wiki` selector;
resolve_diary_wiki(backend, uri, wiki) now prefers it (via the existing
resolve_wiki_selector, which already handles a 0-indexed wiki number) over
the buffer URI. Used by diary_open_relative + diary_open_index.
- Clients: s:diary_open / _diary_open (both) and diary_today/today_tab/
yesterday/tomorrow/index take a count and send {wiki: count-1} when >0. All
22 diary-note + DiaryIndex command defs across the 4 contexts are now
-count=0 passing <count>. diary_next/prev ignore the count.
Tests: cmd.VimwikiMakeDiaryNote_has_count (test-keymaps.lua) +
cmd.Vimwiki{MakeDiaryNote,DiaryIndex}_accepts_count (test-keymaps-vim.vim).
Workspace test/clippy/fmt clean with CI flags; lua 284, vim 272/18/21.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -906,6 +906,15 @@ vim.defer_fn(function()
|
||||
error(':NuwikiGenerateTags not defined')
|
||||
end
|
||||
end)
|
||||
-- Diary-note family carries -count=0 (vimwiki's wiki selector), so
|
||||
-- `:2VimwikiMakeDiaryNote` selects wiki #2 instead of raising E481.
|
||||
tobj_case('cmd.VimwikiMakeDiaryNote_has_count', function()
|
||||
local c = vim.api.nvim_buf_get_commands(0, {}).VimwikiMakeDiaryNote
|
||||
if not c then error(':VimwikiMakeDiaryNote not defined') end
|
||||
if c.count == nil or c.count == false then
|
||||
error('VimwikiMakeDiaryNote missing -count: ' .. vim.inspect(c))
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user