From 212b300fb49d02d599b4bfd71ca528a46441c096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Sun, 31 May 2026 17:28:06 +0000 Subject: [PATCH] fix(client): small mapping/command-attribute parity gaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clean, fully-wired parity fixes (skipping the accept-but-ignore ones): - (macOS Cmd+Return) → follow_link_drop, alongside , in both clients. Upstream binds both to VimwikiTabDropLink. - plugin/nuwiki.vim global map block: fix the same diary collision the buffer-local maps had — wt now opens today in a new tab and wm (tomorrow) is added. - Neovim TabIndex: add -count to NuwikiTabIndex and switch both Vimwiki/NuwikiTabIndex from vim.v.count (always 0 in command context) to , so a count is actually honored. - Converge VimwikiTableMoveColumn{Left,Right}: the Vim-branch commands now call the table_move_column_left/right aliases, matching the Neovim branch. - VimwikiColorize/NuwikiColorize: -nargs=1 → -nargs=* (all four defs) for upstream parity; a bare :VimwikiColorize now prompts for the colour. Docs (README + doc/nuwiki.txt) updated; mapping surfaces gain and wm in both harnesses. vim 265+18, nvim 272, all green. Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 2 +- development/tests/test-keymaps-vim.vim | 5 ++-- development/tests/test-keymaps.lua | 5 ++-- development/vimwiki-gap.md | 37 ++++++++++++++------------ doc/nuwiki.txt | 2 +- ftplugin/vimwiki.vim | 21 ++++++++------- lua/nuwiki/keymaps.lua | 2 ++ plugin/nuwiki.vim | 3 ++- 8 files changed, 43 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 956ed5e..6873a57 100644 --- a/README.md +++ b/README.md @@ -483,7 +483,7 @@ via `mappings. = false` in Neovim, or | `` | Smart follow — inside `[[…]]` jumps; on a bare word wraps as `[[word]]` (second `` follows) | | `` | Follow in horizontal split | | `` | Follow in vertical split | -| `` | Follow in a tab, reusing an existing tab if the file is already open | +| `` / `` | Follow in a tab, reusing an existing tab if the file is already open (`` is the macOS Cmd alias) | | `` | Add the link target to the buffer list (`:badd`, no jump) | | `` | Jump back (``) | | `` / `` | Next / previous wikilink on or after the cursor | diff --git a/development/tests/test-keymaps-vim.vim b/development/tests/test-keymaps-vim.vim index d44db2c..dd34fad 100644 --- a/development/tests/test-keymaps-vim.vim +++ b/development/tests/test-keymaps-vim.vim @@ -184,7 +184,7 @@ endfunction let s:mapping_surface = [ \ ['', 'n'], ['', 'n'], ['', 'n'], ['', 'n'], - \ ['', 'n'], + \ ['', 'n'], ['', 'n'], \ ['', 'n'], ['', 'n'], ['', 'n'], ['+', 'nx'], \ ['', 'nx'], ['', 'nx'], ['', 'nx'], \ ['gnt', 'n'], ['gln', 'nx'], ['glp', 'nx'], ['glx', 'nx'], @@ -201,7 +201,8 @@ let s:mapping_surface = [ \ ['', 'n'], ['', 'n'], \ ['ww', 'n'], ['ws', 'n'], ['wi', 'n'], \ ['ww', 'n'], ['wy', 'n'], - \ ['wt', 'n'], ['wi', 'n'], + \ ['wt', 'n'], ['wm', 'n'], + \ ['wi', 'n'], \ ['wn', 'n'], ['wd', 'n'], ['wr', 'n'], \ ['wh', 'n'], ['whh', 'n'], ['wha', 'n'], \ ['wc', 'nx'], ['', 'n'], ['', 'n'], diff --git a/development/tests/test-keymaps.lua b/development/tests/test-keymaps.lua index 1b9fbd7..0d0a2f3 100644 --- a/development/tests/test-keymaps.lua +++ b/development/tests/test-keymaps.lua @@ -206,7 +206,7 @@ vim.defer_fn(function() local mapping_surface = { -- Links { '', 'n' }, { '', 'n' }, { '', 'n' }, { '', 'n' }, - { '', 'n' }, + { '', 'n' }, { '', 'n' }, { '', 'n' }, { '', 'n' }, { '', 'n' }, { '+', 'nx' }, -- Lists { '', 'nx' }, { '', 'nx' }, { '', 'nx' }, @@ -227,7 +227,8 @@ vim.defer_fn(function() -- Wiki / diary / export { 'ww', 'n' }, { 'ws', 'n' }, { 'wi', 'n' }, { 'ww', 'n' }, { 'wy', 'n' }, - { 'wt', 'n' }, { 'wi', 'n' }, + { 'wt', 'n' }, { 'wm', 'n' }, + { 'wi', 'n' }, { 'wn', 'n' }, { 'wd', 'n' }, { 'wr', 'n' }, { 'wh', 'n' }, { 'whh', 'n' }, { 'wha', 'n' }, { 'wc', 'nx' }, { '', 'n' }, { '', 'n' }, diff --git a/development/vimwiki-gap.md b/development/vimwiki-gap.md index 9494dc1..e721c53 100644 --- a/development/vimwiki-gap.md +++ b/development/vimwiki-gap.md @@ -167,13 +167,14 @@ fix site. Neovim. Works in Vim, coc, and Neovim (pure syntax + `:highlight`, no LSP needed). Covered by `colorize.conceal_hides_tags_shows_text` (both harnesses) and `colorize.command_conceals_immediately` (`test-keymaps-vim.vim`). -- [ ] **`VimwikiTableMoveColumn{Left,Right}` dispatch to different backing names - per client** — Vim branch → `table_move_left/right`; Neovim branch → - `table_move_column_left/right`. Harmless today (each name exists in its own - impl) but a divergence to converge. -- [ ] **`NuwikiTabIndex` lacks `-count` in the Neovim branch** (`:452`) while its - siblings (`VimwikiTabIndex`, `NuwikiIndex`, and the Vim-branch `NuwikiTabIndex`) - all carry it — `vim.v.count` is still read, so a count is honored inconsistently. +- [x] **`VimwikiTableMoveColumn{Left,Right}` dispatch to different backing names + per client** — converged: the Vim-branch commands now call + `nuwiki#commands#table_move_column_left/right` (existing aliases over the + `table_move_left/right` impls), matching the Neovim branch. +- [x] **`NuwikiTabIndex` lacks `-count` in the Neovim branch** — added `-count`; + also switched both Neovim `Vimwiki/NuwikiTabIndex` from `vim.v.count` (always 0 + in command context) to ``, so a `:NNuwikiTabIndex` count is now actually + honored. - [ ] **`VimwikiToggleListItem` / `Increment` / `DecrementListItem` lack `-range`** (both branches) vs upstream's `-range` (`:350`) — no visual-range checkbox toggle / symbol cycle. @@ -189,8 +190,10 @@ fix site. page / tag / colour names at the `:` line is unavailable. _Fix:_ `ftplugin/vimwiki.vim` (both branches) — VimL completers or LSP-backed. - [ ] **Minor command-attribute gaps** _(new)_ — `VimwikiNormalizeLink` lacks - upstream's `-nargs=?`; `VimwikiCheckLinks` lacks `-range`; `VimwikiColorize` is - `-nargs=1` vs upstream `-nargs=*`. Cosmetic. + upstream's `-nargs=?`; `VimwikiCheckLinks` lacks `-range`. (`VimwikiColorize` + `-nargs=1`→`-nargs=*` **done** — all four defs now match upstream, so a bare + `:VimwikiColorize` prompts for the colour.) The remaining two would be + accepted-but-ignored without handler work, so left open. ### Config - [ ] `auto_header` — auto H1-from-filename on new page (server-side). @@ -215,14 +218,14 @@ fix site. all lists; upstream `ftplugin/vimwiki.vim:553,555,561`). nuwiki has the lowercase forms but not the uppercase-suffix aliases. Cosmetic — same effect, redundant keys. -- [ ] **`` (Cmd+Return) tab-drop alias** _(new, 2026-05-31 re-audit)_ — - upstream binds both `` and the macOS `` to `VimwikiTabDropLink`; - nuwiki binds only `` (both clients). Niche (macOS GUI). _Fix:_ - `lua/nuwiki/keymaps.lua`, `ftplugin/vimwiki.vim` alongside ``. -- [ ] **`wm` missing from the Vim *global* map block** _(new)_ — - present buffer-locally in both clients, but `plugin/nuwiki.vim`'s global - `w*` family (usable from non-wiki buffers) binds `w`/`y`/`t`/`i` - but not `m` (tomorrow), which upstream binds globally. _Fix:_ `plugin/nuwiki.vim`. +- [x] **`` (Cmd+Return) tab-drop alias** _(new, 2026-05-31 re-audit)_ — + added `` → `follow_link_drop` alongside `` in both clients + (`lua/nuwiki/keymaps.lua`, `ftplugin/vimwiki.vim`); docs updated. Covered by + `map[n].` in both harnesses. +- [x] **`wm` missing from the Vim *global* map block** _(new)_ — + `plugin/nuwiki.vim`'s global family now binds `wm` (tomorrow) + and `wt` opens today in a new tab (was the same collision the + buffer-local maps had). Covered by `map[n].wm` in both harnesses. --- diff --git a/doc/nuwiki.txt b/doc/nuwiki.txt index 87b791b..148970d 100644 --- a/doc/nuwiki.txt +++ b/doc/nuwiki.txt @@ -436,7 +436,7 @@ Links (normal mode) ~ Follow in a horizontal split. Follow in a vertical split. Follow in a tab, reusing an existing tab if the file is - already open. + already open. `` (macOS Cmd) is an alias. Add the link target to the buffer list (`:badd`, no jump). Jump back (``). Next wikilink on or after the cursor. diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 0482835..2389310 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -111,9 +111,9 @@ if !has('nvim') " Tables, colorize, and clipboard paste. command! -buffer -nargs=1 VimwikiTable call nuwiki#commands#table_insert() - command! -buffer VimwikiTableMoveColumnLeft call nuwiki#commands#table_move_left() - command! -buffer VimwikiTableMoveColumnRight call nuwiki#commands#table_move_right() - command! -buffer -nargs=1 -range VimwikiColorize call nuwiki#commands#colorize(, ) + 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(, ) command! -buffer VimwikiPasteLink call nuwiki#commands#paste_link() command! -buffer VimwikiPasteUrl call nuwiki#commands#paste_url() command! -buffer VimwikiCatUrl call nuwiki#commands#cat_url() @@ -182,9 +182,9 @@ if !has('nvim') 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 NuwikiTableMoveColumnLeft call nuwiki#commands#table_move_left() - command! -buffer NuwikiTableMoveColumnRight call nuwiki#commands#table_move_right() - command! -buffer -nargs=1 -range NuwikiColorize call nuwiki#commands#colorize(, ) + 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(, ) command! -buffer NuwikiPasteLink call nuwiki#commands#paste_link() command! -buffer NuwikiPasteUrl call nuwiki#commands#paste_url() command! -buffer NuwikiCatUrl call nuwiki#commands#cat_url() @@ -217,6 +217,7 @@ if !has('nvim') nnoremap :split:call nuwiki#commands#follow_link_or_create() nnoremap :vsplit:call nuwiki#commands#follow_link_or_create() nnoremap :call nuwiki#commands#follow_link_drop() + nnoremap :call nuwiki#commands#follow_link_drop() nnoremap :call nuwiki#commands#badd_link() nnoremap nnoremap /\[\[:nohlsearch @@ -384,7 +385,7 @@ endif " or, for client-side operations, calls `vim.lsp.buf.*` directly. command! -buffer -count VimwikiIndex lua require('nuwiki.commands').wiki_index(vim.v.count) -command! -buffer -count VimwikiTabIndex lua require('nuwiki.commands').wiki_tab_index(vim.v.count) +command! -buffer -count 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() @@ -453,14 +454,14 @@ command! -buffer -nargs=? VimwikiGenerateTags lua require('nuwiki.commands' command! -buffer -nargs=1 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=1 -range VimwikiColorize lua require('nuwiki.commands').colorize(, > 0) +command! -buffer -nargs=* -range VimwikiColorize lua require('nuwiki.commands').colorize(, > 0) command! -buffer VimwikiPasteLink lua require('nuwiki.commands').paste_link() command! -buffer VimwikiPasteUrl lua require('nuwiki.commands').paste_url() command! -buffer VimwikiCatUrl lua require('nuwiki.commands').cat_url() " Canonical :Nuwiki* aliases — P10. command! -buffer -count NuwikiIndex lua require('nuwiki.commands').wiki_index(vim.v.count) -command! -buffer NuwikiTabIndex lua require('nuwiki.commands').wiki_tab_index(vim.v.count) +command! -buffer -count 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() @@ -525,7 +526,7 @@ command! -buffer NuwikiTableAlign lua require('nuwiki.command command! -buffer -nargs=1 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=1 -range NuwikiColorize lua require('nuwiki.commands').colorize(, > 0) +command! -buffer -nargs=* -range NuwikiColorize lua require('nuwiki.commands').colorize(, > 0) command! -buffer NuwikiPasteLink lua require('nuwiki.commands').paste_link() command! -buffer NuwikiPasteUrl lua require('nuwiki.commands').paste_url() command! -buffer NuwikiCatUrl lua require('nuwiki.commands').cat_url() diff --git a/lua/nuwiki/keymaps.lua b/lua/nuwiki/keymaps.lua index c9812dd..80b6bf0 100644 --- a/lua/nuwiki/keymaps.lua +++ b/lua/nuwiki/keymaps.lua @@ -166,6 +166,8 @@ function M.attach(bufnr, mappings) { desc = 'nuwiki: follow link in vsplit' }, bufnr) map('n', '', cmd.follow_link_drop, { desc = 'nuwiki: follow link in tab (reuse existing)' }, bufnr) + map('n', '', cmd.follow_link_drop, + { desc = 'nuwiki: follow link in tab (macOS Cmd alias of )' }, bufnr) map('n', '', cmd.badd_link, { desc = 'nuwiki: add link target to buffer list' }, bufnr) map('n', '', '', { desc = 'nuwiki: go back', remap = true }, bufnr) diff --git a/plugin/nuwiki.vim b/plugin/nuwiki.vim index 8a2a71e..2b61496 100644 --- a/plugin/nuwiki.vim +++ b/plugin/nuwiki.vim @@ -57,6 +57,7 @@ if !get(g:, 'nuwiki_no_default_mappings', 0) nnoremap wi :call nuwiki#commands#open_diary_index_path() nnoremap ww :call nuwiki#commands#open_diary_path(0) nnoremap wy :call nuwiki#commands#open_diary_path(-1) - nnoremap wt :call nuwiki#commands#open_diary_path(1) + nnoremap wt :tabnew:call nuwiki#commands#open_diary_path(0) + nnoremap wm :call nuwiki#commands#open_diary_path(1) nnoremap wi :call nuwiki#commands#diary_generate_index() endif