fix(keymaps): correct Neovim global diary tab/tomorrow maps (map_prefix audit)
CI / cargo fmt --check (push) Failing after 27s
CI / cargo clippy (push) Successful in 33s
CI / cargo test (push) Successful in 37s
CI / editor keymaps (push) Successful in 1m33s

A map_prefix parity audit against upstream vimwiki found the Neovim global
entry-point block in lua/nuwiki/init.lua carried the same collision the Vim
global + buffer-local maps were already fixed for: <prefix><Leader>t was
bound to tomorrow and <prefix><Leader>m (tomorrow) was missing entirely.

Now <prefix><Leader>t opens today in a new tab and <prefix><Leader>m is
tomorrow — consistent with plugin/nuwiki.vim, the buffer-local maps, and
upstream (VimwikiTabMakeDiaryNote / VimwikiMakeTomorrowDiaryNote).

Adds global_maps.diary_tab_and_tomorrow_targets to test-keymaps.lua (queries
in a scratch buffer so buffer-local maps don't shadow the globals). Logs the
fix plus a new "RSS feed structure fidelity" gap (the audit confirmed the
custom_wiki2html arg contract and base_url scope are faithful; only the RSS
document shape diverges) in development/vimwiki-gap.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 19:22:52 +00:00
parent feedd30c4d
commit 2a8e2b9ea9
3 changed files with 46 additions and 1 deletions
+27
View File
@@ -850,6 +850,33 @@ vim.defer_fn(function()
if not ok then error(err) end
end)
-- ===== Global (non-buffer) entry-point diary maps =====
-- init.lua _setup_global_mappings ran during setup(). Regression guard for
-- the audit-found bug: <prefix><Leader>t must be today-in-a-tab and
-- <prefix><Leader>m must be tomorrow (matching the Vim global side +
-- upstream), not the old wiring that dropped `m` and bound `t` to tomorrow.
-- Query in a scratch (non-vimwiki) buffer so the buffer-local maps don't
-- shadow the globals.
tobj_case('global_maps.diary_tab_and_tomorrow_targets', function()
local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_set_current_buf(buf)
local function gdesc(lhs)
local d = vim.fn.maparg(lhs, 'n', false, true)
if vim.tbl_isempty(d) then return nil end
return d.desc or ''
end
local ok, err = pcall(function()
local t = gdesc('<Leader>w<Leader>t')
local m = gdesc('<Leader>w<Leader>m')
if not t then error('<Leader>w<Leader>t global map missing') end
if not m then error('<Leader>w<Leader>m global map missing (tomorrow)') end
if not t:find('tab') then error('<Leader>w<Leader>t should be today-in-tab, desc=' .. t) end
if not m:find('tomorrow') then error('<Leader>w<Leader>m should be tomorrow, desc=' .. m) end
end)
vim.api.nvim_buf_delete(buf, { force = true })
if not ok then error(err) end
end)
-- ===== Wiki picker (config-driven, no LSP) =====
-- The picker must build its list from config so it works from any buffer
-- before the server attaches.
+17
View File
@@ -267,6 +267,16 @@ fix site.
- [ ] `commentstring` (`'%%%s'`) — comment toggling/text-objects.
- [ ] `color_tag_template``color_dic` present; template regex missing.
- [ ] `rss_max_items` / `rss_name``:Rss` output hardcoded. _Fix:_ `HtmlConfig`.
- [ ] **RSS feed structure fidelity** _(new, 2026-05-31 base_url audit)_ —
nuwiki's `write_rss` is intentionally minimal (title/link/guid). Upstream
emits more: channel `<link>` points at the diary index page
(`base_url + diary_rel_path + diary_index + .html`, nuwiki uses bare
`base_url`); per-item `<guid isPermaLink="false">` holds the bare date
basename (nuwiki uses the full URL, no attribute); plus `<atom:link rel=
"self">`, channel/item `<pubDate>` (from mtime), and a `<![CDATA[…]]>`
rendered-HTML body per item. `base_url`'s *scope* is faithful (RSS-only,
not inter-page links) and the `custom_wiki2html` arg contract is an exact
match — only the feed document shape diverges.
- [ ] `emoji_enable` — emoji substitution.
- [ ] `html_header_numbering` (+`_sym`) — numbered HTML headers.
- [ ] `valid_html_tags` — allowed inline HTML tags in export.
@@ -289,6 +299,13 @@ fix site.
`plugin/nuwiki.vim`'s global family now binds `<Leader>w<Leader>m` (tomorrow)
and `<Leader>w<Leader>t` opens today in a new tab (was the same collision the
buffer-local maps had). Covered by `map[n].<Leader>w<Leader>m` in both harnesses.
- [x] **`<Leader>w<Leader>m` missing from the Neovim *global* map block**
_(new, 2026-05-31 map_prefix audit)_ — the same collision survived in
`lua/nuwiki/init.lua`'s `_setup_global_mappings`: `<prefix><Leader>t` was
bound to tomorrow and `<prefix><Leader>m` (tomorrow) was absent entirely.
Fixed so `<prefix><Leader>t` opens today in a new tab and `<prefix><Leader>m`
is tomorrow — now consistent with the Vim global side + upstream. Covered by
`global_maps.diary_tab_and_tomorrow_targets` (`test-keymaps.lua`).
---
+2 -1
View File
@@ -57,7 +57,8 @@ local function _setup_global_mappings()
kmap('n', p .. 'i', function() _open(_diary_path(nil)) end, o('diary index'))
kmap('n', p .. '<Leader>w', function() _open(_diary_path(0)) end, o('today diary'))
kmap('n', p .. '<Leader>y', function() _open(_diary_path(-1)) end, o('yesterday diary'))
kmap('n', p .. '<Leader>t', function() _open(_diary_path(1)) end, o('tomorrow diary'))
kmap('n', p .. '<Leader>t', function() _open(_diary_path(0), 'tabedit') end, o('today diary (tab)'))
kmap('n', p .. '<Leader>m', function() _open(_diary_path(1)) end, o('tomorrow diary'))
kmap('n', p .. '<Leader>i', function() require('nuwiki.commands').diary_generate_index() end, o('rebuild diary index'))
end