From c161f9d21aac308a69bc2a0a4e3970f38f5d8608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Wed, 3 Jun 2026 00:28:51 +0000 Subject: [PATCH] =?UTF-8?q?feat(parity):=20P3=20quick-wins=20=E2=80=94=20S?= =?UTF-8?q?howVersion,=20gLH/gLL/gLR,=20Search/Align=20nargs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes four low-risk P3 parity items (gap doc updated): - VimwikiShowVersion / NuwikiShowVersion: new global command (both clients) echoing g:nuwiki_version (0.1.0) + the host editor, via nuwiki#commands#show_version / commands.show_version. - gLH / gLL / gLR: upstream's case-variant aliases of gLh/gLl/gLr (dedent / indent whole item, renumber all lists) added in both clients. - VimwikiSearch / VWS: -nargs=1 -> -nargs=* (Vim + Neovim), so a multi-word search no longer raises E488 and an empty invocation reuses the last search pattern. (The lvimgrep-vs-vimwiki-engine difference stays open.) - VimwikiTableAlignQ / AlignW / NuwikiTableAlign: bare -> -nargs=?, so `:VimwikiTableAlignQ 2` no longer raises E488 (optional column arg is accepted-and-ignored; the gqq-align vs gww-align-without-resize split stays open). Docs (doc/nuwiki.txt + README) updated for the command and the aliases. Tests: surface.{Vimwiki,Nuwiki}ShowVersion, map[n].gL{H,L,R} (both harnesses), cmd.search_and_tablealign_nargs (vim). Neovim 291, Vim 282/18/21 pass. Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 6 ++--- autoload/nuwiki/commands.vim | 7 +++++ development/tests/test-keymaps-vim.vim | 25 ++++++++++++++++- development/tests/test-keymaps.lua | 4 ++- development/vimwiki-gap.md | 37 +++++++++++++++++--------- doc/nuwiki.txt | 11 +++++--- ftplugin/vimwiki.vim | 24 ++++++++++------- lua/nuwiki/commands.lua | 9 +++++++ lua/nuwiki/init.lua | 4 +++ lua/nuwiki/keymaps.lua | 7 +++++ plugin/nuwiki.vim | 10 +++++++ 11 files changed, 114 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index d507cb1..ce82797 100644 --- a/README.md +++ b/README.md @@ -253,7 +253,7 @@ require('nuwiki').setup({ enabled = true, wiki_prefix = true, -- w{w,t,s,i}, w{w,y,t,m,i} links = true, -- , , , , , , , , , + (n/x), w{n,d,r}, wc (n/x) - lists = true, -- , gnt, gln, glp, glx, glh, gll, gLh, gLl, glr, gLr, gl{-,*,#,1,i,I,a,A}, gL{…}, gl, gL, o, O; insert , , , + lists = true, -- , gnt, gln, glp, glx, glh, gll, gLh, gLl (aliases gLH/gLL), glr, gLr (alias gLR), gl{-,*,#,1,i,I,a,A}, gL{…}, gl, gL, o, O; insert , , , headers = true, -- =, -, ]], [[, ]=, [=, ]u, [u table_editing = true, -- gqq, gq1, gww, gw1, , ; insert , diary = true, -- , @@ -315,7 +315,7 @@ The `w` prefix in the `wiki_prefix`, `links`, and `html_export` rows is | `enabled` | `true` | master switch for the whole keymap layer | | `wiki_prefix` | `true` | `ww`, `wt`, `ws`, `wi`, `ww`, `wy`, `wt`, `wm`, `wi` | | `links` | `true` | ``, ``, ``, ``, ``, ``, ``, ``, ``, `+` (normal + visual), `wn`, `wd`, `wr`, `wc` (normal + visual) | -| `lists` | `true` | `` (also ``/``), `gnt`, `gln`, `glp`, `glx`, `glh`, `gll`, `gLh`, `gLl`, `glr`, `gLr`, `gl-`, `gl*`, `gl#`, `gl1`, `gli`, `glI`, `gla`, `glA`, `gL-`, `gL*`, `gL#`, `gL1`, `gLi`, `gLI`, `gLa`, `gLA`, `gl`, `gL`, `o`, `O`; insert: ``, ``, ``, ``, ``, `` | +| `lists` | `true` | `` (also ``/``), `gnt`, `gln`, `glp`, `glx`, `glh`, `gll`, `gLh`, `gLl`, `gLH`, `gLL`, `glr`, `gLr`, `gLR`, `gl-`, `gl*`, `gl#`, `gl1`, `gli`, `glI`, `gla`, `glA`, `gL-`, `gL*`, `gL#`, `gL1`, `gLi`, `gLI`, `gLa`, `gLA`, `gl`, `gL`, `o`, `O`; insert: ``, ``, ``, ``, ``, `` | | `headers` | `true` | `=`, `-`, `]]`, `[[`, `]=`, `[=`, `]u`, `[u` | | `table_editing` | `true` | `gqq`, `gq1`, `gww`, `gw1`, ``, ``; insert: ``, `` | | `diary` | `true` | ``, `` | @@ -388,7 +388,7 @@ For users configuring without Lua. | `g:nuwiki_no_default_mappings` | `0` | `1` skips the whole keymap layer | | `g:nuwiki_no_wiki_prefix_mappings` | `0` | `1` skips the `wiki_prefix` group (`ww`, `wt`, `ws`, `wi`, `w{w,y,t,m,i}`) | | `g:nuwiki_no_links_mappings` | `0` | `1` skips the `links` group (``, ``, ``, ``, ``, ``, ``, ``, ``, `+`, `w{n,d,r,c}`) | -| `g:nuwiki_no_lists_mappings` | `0` | `1` skips the `lists` group (``, `gnt`, `gln`, `glp`, `glx`, `glh`, `gll`, `gLh`, `gLl`, `glr`, `gLr`, `gl{-,*,#,1,i,I,a,A}`, `gL{…}`, `gl`, `gL`, `o`, `O`; insert ``, ``, ``, ``) | +| `g:nuwiki_no_lists_mappings` | `0` | `1` skips the `lists` group (``, `gnt`, `gln`, `glp`, `glx`, `glh`, `gll`, `gLh`, `gLl` (aliases `gLH`/`gLL`), `glr`, `gLr` (alias `gLR`), `gl{-,*,#,1,i,I,a,A}`, `gL{…}`, `gl`, `gL`, `o`, `O`; insert ``, ``, ``, ``) | | `g:nuwiki_no_headers_mappings` | `0` | `1` skips the `headers` group (`=`, `-`, `]]`, `[[`, `]=`, `[=`, `]u`, `[u`) | | `g:nuwiki_no_table_editing_mappings` | `0` | `1` skips the `table_editing` group (`gqq`, `gq1`, `gww`, `gw1`, ``, ``; insert ``, ``) | | `g:nuwiki_no_diary_mappings` | `0` | `1` skips the `diary` nav group (``, ``) | diff --git a/autoload/nuwiki/commands.vim b/autoload/nuwiki/commands.vim index 5a775f9..7e54523 100644 --- a/autoload/nuwiki/commands.vim +++ b/autoload/nuwiki/commands.vim @@ -168,6 +168,13 @@ endfunction " from the server, so the picker works from any buffer before a wiki file is " ever opened — opening the chosen index then auto-starts the LSP via the " FileType autocmd. Plain Vim has no `vim.ui.select`, so use `inputlist()`. +" :VimwikiShowVersion / :NuwikiShowVersion — echo the nuwiki version and the +" host editor, mirroring upstream's version banner. +function! nuwiki#commands#show_version() abort + echo 'nuwiki: ' . get(g:, 'nuwiki_version', '?') + echo (has('nvim') ? 'Neovim' : 'Vim') . ': ' . v:version +endfunction + function! nuwiki#commands#wiki_ui_select() abort let l:wikis = nuwiki#commands#wiki_list() if empty(l:wikis) diff --git a/development/tests/test-keymaps-vim.vim b/development/tests/test-keymaps-vim.vim index ce7ff62..b0a6d37 100644 --- a/development/tests/test-keymaps-vim.vim +++ b/development/tests/test-keymaps-vim.vim @@ -112,7 +112,7 @@ let s:both_forms = [ \ 'RebuildTags', '2HTML', '2HTMLBrowse', 'All2HTML', 'Rss', \ 'NormalizeLink', 'RenumberList', 'RenumberAllLists', \ 'ListToggle', 'IncrementListItem', 'DecrementListItem', - \ 'CatUrl', + \ 'CatUrl', 'ShowVersion', \ ] for s:suffix in s:both_forms for s:prefix in ['Nuwiki', 'Vimwiki'] @@ -189,6 +189,7 @@ let s:mapping_surface = [ \ ['', 'nx'], ['', 'nx'], ['', 'nx'], \ ['gnt', 'n'], ['gln', 'nx'], ['glp', 'nx'], ['glx', 'nx'], \ ['glh', 'n'], ['gll', 'n'], ['gLh', 'n'], ['gLl', 'n'], + \ ['gLH', 'n'], ['gLL', 'n'], ['gLR', 'n'], \ ['glr', 'n'], ['gLr', 'n'], ['gl', 'n'], ['gL', 'n'], \ ['gl-', 'n'], ['gL-', 'n'], ['gl*', 'n'], ['gL*', 'n'], \ ['gl#', 'n'], ['gL#', 'n'], ['gl1', 'n'], ['gL1', 'n'], @@ -669,6 +670,28 @@ call s:record( \ 'cmd.VimwikiListChangeLvl_accepts_range_and_args', \ 'err=' . s:lcl_err) +" ===== :VimwikiSearch / VWS -nargs=* + :VimwikiTableAlignQ/W -nargs=? ===== +" Upstream attributes: Search/VWS take -nargs=* (was -nargs=1, so a multi-word +" `:VimwikiSearch foo bar` raised E488); TableAlignQ/W take -nargs=? (were bare, +" so `:VimwikiTableAlignQ 2` raised E488). lvimgrep/align run for real here, so +" swallow any non-attribute error and assert only that E488 is gone. +let s:attr_err = '' +try + silent! VimwikiSearch foo bar + silent! VWS foo bar + silent! VimwikiTableAlignQ 2 + silent! VimwikiTableAlignW 2 + silent! NuwikiTableAlign 2 +catch /E488/ + let s:attr_err = v:exception +catch + " runtime errors (no match, empty table, …) are expected and fine here. +endtry +call s:record( + \ s:attr_err ==# '' ? 1 : 0, + \ 'cmd.search_and_tablealign_nargs', + \ 'err=' . s:attr_err) + " ===== :VimwikiRemoveDone -bang -range ===== " Upstream is `-range`; nuwiki had `-bang` only, so `:'<,'>VimwikiRemoveDone` " raised E481. Now `-bang -range`: a ranged invocation must parse (no E481), diff --git a/development/tests/test-keymaps.lua b/development/tests/test-keymaps.lua index 3969c37..44d0d7c 100644 --- a/development/tests/test-keymaps.lua +++ b/development/tests/test-keymaps.lua @@ -139,7 +139,7 @@ vim.defer_fn(function() 'RebuildTags', '2HTML', '2HTMLBrowse', 'All2HTML', 'Rss', 'NormalizeLink', 'RenumberList', 'RenumberAllLists', 'ListToggle', 'IncrementListItem', 'DecrementListItem', - 'CatUrl', + 'CatUrl', 'ShowVersion', } for _, suffix in ipairs(both_forms) do for _, prefix in ipairs({ 'Nuwiki', 'Vimwiki' }) do @@ -212,6 +212,8 @@ vim.defer_fn(function() { '', 'nx' }, { '', 'nx' }, { '', 'nx' }, { 'gnt', 'n' }, { 'gln', 'nx' }, { 'glp', 'nx' }, { 'glx', 'nx' }, { 'glh', 'n' }, { 'gll', 'n' }, { 'gLh', 'n' }, { 'gLl', 'n' }, + -- Upstream case-variant aliases of gLh/gLl/gLr. + { 'gLH', 'n' }, { 'gLL', 'n' }, { 'gLR', 'n' }, { 'glr', 'n' }, { 'gLr', 'n' }, { 'gl', 'n' }, { 'gL', 'n' }, { 'gl-', 'n' }, { 'gL-', 'n' }, { 'gl*', 'n' }, { 'gL*', 'n' }, { 'gl#', 'n' }, { 'gL#', 'n' }, { 'gl1', 'n' }, { 'gL1', 'n' }, diff --git a/development/vimwiki-gap.md b/development/vimwiki-gap.md index e1cfdeb..4f81689 100644 --- a/development/vimwiki-gap.md +++ b/development/vimwiki-gap.md @@ -173,12 +173,20 @@ fix site. ### Commands - [ ] `VimwikiVar` — config-var get/set introspection. _Fix:_ `plugin/nuwiki.vim`. -- [ ] `VimwikiShowVersion` — print version (trivial). _Fix:_ `plugin/nuwiki.vim`. +- [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 lost. _(Re-audit 2026-05-31: - also note the attr differs — both are defined bare in all four contexts vs - upstream's `-nargs=?`, so `:VimwikiTableAlignQ 2` raises E488.)_ + (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] `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 `` to `table_insert` (which already parsed @@ -224,9 +232,13 @@ 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. - _(Re-audit 2026-05-31: also `-nargs=1` in all four contexts vs upstream - `-nargs=*`.)_ +- [ ] `: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] **`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 @@ -476,11 +488,12 @@ fix site. ### Mappings - [ ] Visual `` normalize-link (visual `+` covers the same intent). - [ ] Insert `` multiline list item. -- [ ] `gLH` / `gLL` / `gLR` — upstream binds these as case-variant **aliases** - of `gLh` / `gLl` / `gLr` (same actions: dedent / indent whole item, renumber - 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. +- [x] **`gLH` / `gLL` / `gLR`** _(fixed 2026-06-03)_ — upstream binds these as + case-variant **aliases** of `gLh` / `gLl` / `gLr` (dedent / indent whole item, + renumber all lists; upstream `ftplugin/vimwiki.vim:553,555,561`). nuwiki had + only the lowercase forms. _Fix:_ added the uppercase-suffix aliases (same + actions) in both clients (`lua/nuwiki/keymaps.lua`, `ftplugin/vimwiki.vim`). + Covered by `map[n].gL{H,L,R}` in both harnesses. - [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 diff --git a/doc/nuwiki.txt b/doc/nuwiki.txt index bf6ca41..7ea17a3 100644 --- a/doc/nuwiki.txt +++ b/doc/nuwiki.txt @@ -349,6 +349,11 @@ Wiki / navigation ~ Pick a wiki from a list (multi-wiki only). Uses |vim.ui.select| on Neovim, |inputlist()| on Vim. + *:NuwikiShowVersion* +:NuwikiShowVersion + Echo the nuwiki version (`g:nuwiki_version`) and the host editor. + Also available as `:VimwikiShowVersion`. + *:NuwikiGoto* :NuwikiGoto {page} Open `{page}.wiki` by name. @@ -611,10 +616,10 @@ Lists (normal mode) ~ gnt Jump to the next unfinished task. glh Dedent the current list item. gll Indent the current list item. - gLh Dedent the item including its sublist. - gLl Indent the item including its sublist. + gLh Dedent the item including its sublist. (alias: gLH) + gLl Indent the item including its sublist. (alias: gLL) glr Renumber the current ordered list. - gLr Renumber every ordered list in the buffer. + gLr Renumber every ordered list in the buffer. (alias: gLR) gl Set the current item's marker to , where is one of `-` `*` `#` `1` (1.) `i` (i)) `I` (I)) `a` (a)) `A` (A)). For `1)` use `:NuwikiChangeSymbol 1)` (no single-key form). diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 35968a1..a0aa09b 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -67,8 +67,8 @@ if !has('nvim') command! -buffer VimwikiNextLink call nuwiki#commands#link_next() command! -buffer VimwikiPrevLink call nuwiki#commands#link_prev() command! -buffer VimwikiBaddLink call nuwiki#commands#badd_link() - command! -buffer -nargs=1 VimwikiSearch lvimgrep // ** - command! -buffer -nargs=1 VWS lvimgrep // ** + command! -buffer -nargs=* VimwikiSearch lvimgrep // ** + command! -buffer -nargs=* VWS lvimgrep // ** command! -buffer -nargs=1 -complete=customlist,nuwiki#complete#pages VimwikiGoto call nuwiki#commands#wiki_goto_page() command! -buffer VimwikiDeleteFile call nuwiki#commands#delete_file() @@ -91,8 +91,8 @@ if !has('nvim') command! -buffer -nargs=? VimwikiNormalizeLink call nuwiki#commands#normalize_link() command! -buffer VimwikiRenumberList call nuwiki#commands#list_renumber() command! -buffer VimwikiRenumberAllLists call nuwiki#commands#list_renumber_all() - command! -buffer VimwikiTableAlignQ call nuwiki#commands#table_align() - command! -buffer VimwikiTableAlignW call nuwiki#commands#table_align() + command! -buffer -nargs=? VimwikiTableAlignQ call nuwiki#commands#table_align() + command! -buffer -nargs=? VimwikiTableAlignW call nuwiki#commands#table_align() command! -buffer Vimwiki2HTML call nuwiki#commands#export_current() command! -buffer Vimwiki2HTMLBrowse call nuwiki#commands#export_browse() @@ -182,7 +182,7 @@ if !has('nvim') command! -buffer -nargs=? NuwikiNormalizeLink call nuwiki#commands#normalize_link() command! -buffer NuwikiRenumberList call nuwiki#commands#list_renumber() command! -buffer NuwikiRenumberAllLists call nuwiki#commands#list_renumber_all() - command! -buffer NuwikiTableAlign call nuwiki#commands#table_align() + command! -buffer -nargs=? NuwikiTableAlign call nuwiki#commands#table_align() command! -buffer -nargs=* NuwikiTable call nuwiki#commands#table_insert() command! -buffer NuwikiTableMoveColumnLeft call nuwiki#commands#table_move_column_left() command! -buffer NuwikiTableMoveColumnRight call nuwiki#commands#table_move_column_right() @@ -262,8 +262,12 @@ if !has('nvim') nnoremap gll :call nuwiki#commands#list_change_level(1, 0) nnoremap gLh :call nuwiki#commands#list_change_level(-1, 1) nnoremap gLl :call nuwiki#commands#list_change_level(1, 1) + " Upstream binds case-variant aliases gLH/gLL/gLR == gLh/gLl/gLr. + nnoremap gLH :call nuwiki#commands#list_change_level(-1, 1) + nnoremap gLL :call nuwiki#commands#list_change_level(1, 1) nnoremap glr :call nuwiki#commands#list_renumber() nnoremap gLr :call nuwiki#commands#list_renumber_all() + nnoremap gLR :call nuwiki#commands#list_renumber_all() " gl/gL: set the current item's / whole list's marker (upstream " VimwikiChangeSymbolTo / ChangeSymbolInListTo). 1) is command-only. nnoremap gl- :call nuwiki#commands#list_change_symbol('-', 0) @@ -416,8 +420,8 @@ command! -buffer VimwikiBaddLink lua require('nuwiki.commands').badd_l command! -buffer -nargs=1 -complete=customlist,nuwiki#complete#pages VimwikiGoto lua require('nuwiki.commands').wiki_goto_page() command! -buffer VimwikiBacklinks lua vim.lsp.buf.references() command! -buffer VWB lua vim.lsp.buf.references() -command! -buffer -nargs=1 VimwikiSearch lvimgrep // ** -command! -buffer -nargs=1 VWS lvimgrep // ** +command! -buffer -nargs=* VimwikiSearch lvimgrep // ** +command! -buffer -nargs=* VWS lvimgrep // ** command! -buffer VimwikiDeleteFile lua require('nuwiki.commands').delete_file() command! -buffer VimwikiDeleteLink lua require('nuwiki.commands').delete_file() @@ -440,8 +444,8 @@ command! -buffer -range -nargs=+ VimwikiListChangeLvl lua require('nuwiki command! -buffer -nargs=? VimwikiNormalizeLink lua require('nuwiki.commands').normalize_link() command! -buffer VimwikiRenumberList lua require('nuwiki.commands').list_renumber() command! -buffer VimwikiRenumberAllLists lua require('nuwiki.commands').list_renumber_all() -command! -buffer VimwikiTableAlignQ lua require('nuwiki.commands').table_align() -command! -buffer VimwikiTableAlignW lua require('nuwiki.commands').table_align() +command! -buffer -nargs=? VimwikiTableAlignQ lua require('nuwiki.commands').table_align() +command! -buffer -nargs=? VimwikiTableAlignW lua require('nuwiki.commands').table_align() command! -buffer Vimwiki2HTML lua require('nuwiki.commands').export_current() command! -buffer Vimwiki2HTMLBrowse lua require('nuwiki.commands').export_browse() @@ -531,7 +535,7 @@ command! -buffer -nargs=1 NuwikiChangeSymbolInList lua require('nuwiki.comma command! -buffer -nargs=? NuwikiNormalizeLink lua require('nuwiki.commands').normalize_link() command! -buffer NuwikiRenumberList lua require('nuwiki.commands').list_renumber() command! -buffer NuwikiRenumberAllLists lua require('nuwiki.commands').list_renumber_all() -command! -buffer NuwikiTableAlign lua require('nuwiki.commands').table_align() +command! -buffer -nargs=? NuwikiTableAlign lua require('nuwiki.commands').table_align() command! -buffer -nargs=* 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() diff --git a/lua/nuwiki/commands.lua b/lua/nuwiki/commands.lua index 6756228..8df7342 100644 --- a/lua/nuwiki/commands.lua +++ b/lua/nuwiki/commands.lua @@ -276,6 +276,15 @@ end -- Pick a wiki and open its index. The list is read straight from config -- (no LSP round-trip) so this works from any buffer before a wiki file is -- ever opened; opening the index then auto-starts the server. +-- :VimwikiShowVersion / :NuwikiShowVersion — echo the nuwiki version + editor. +function M.show_version() + local ver = vim.g.nuwiki_version or '?' + vim.api.nvim_echo({ + { 'nuwiki: ' .. ver .. '\n' }, + { 'Neovim: ' .. tostring(vim.version()) }, + }, false, {}) +end + function M.wiki_ui_select() local wikis = require('nuwiki.config').wiki_list() if #wikis == 0 then diff --git a/lua/nuwiki/init.lua b/lua/nuwiki/init.lua index 717f62e..ea7c5b7 100644 --- a/lua/nuwiki/init.lua +++ b/lua/nuwiki/init.lua @@ -70,6 +70,10 @@ local function _setup_global_commands() local function ui_select() require('nuwiki.commands').wiki_ui_select() end vim.api.nvim_create_user_command('VimwikiUISelect', ui_select, {}) vim.api.nvim_create_user_command('NuwikiUISelect', ui_select, {}) + + local function show_version() require('nuwiki.commands').show_version() end + vim.api.nvim_create_user_command('VimwikiShowVersion', show_version, {}) + vim.api.nvim_create_user_command('NuwikiShowVersion', show_version, {}) end function M.setup(opts) diff --git a/lua/nuwiki/keymaps.lua b/lua/nuwiki/keymaps.lua index fd72159..43711e3 100644 --- a/lua/nuwiki/keymaps.lua +++ b/lua/nuwiki/keymaps.lua @@ -225,10 +225,17 @@ function M.attach(bufnr, mappings) { desc = 'nuwiki: list dedent subtree' }, bufnr) map('n', 'gLl', function() cmd.list_change_level(1, true) end, { desc = 'nuwiki: list indent subtree' }, bufnr) + -- Upstream binds case-variant aliases gLH/gLL/gLR == gLh/gLl/gLr. + map('n', 'gLH', function() cmd.list_change_level(-1, true) end, + { desc = 'nuwiki: list dedent subtree' }, bufnr) + map('n', 'gLL', function() cmd.list_change_level(1, true) end, + { desc = 'nuwiki: list indent subtree' }, bufnr) map('n', 'glr', cmd.list_renumber, { desc = 'nuwiki: renumber list' }, bufnr) map('n', 'gLr', cmd.list_renumber_all, { desc = 'nuwiki: renumber all lists' }, bufnr) + map('n', 'gLR', cmd.list_renumber_all, + { desc = 'nuwiki: renumber all lists' }, bufnr) -- gl/gL: set the current item's / whole list's marker (upstream -- VimwikiChangeSymbolTo / ChangeSymbolInListTo). 1) is command-only. for _, pair in ipairs({ diff --git a/plugin/nuwiki.vim b/plugin/nuwiki.vim index b5b638c..56034d6 100644 --- a/plugin/nuwiki.vim +++ b/plugin/nuwiki.vim @@ -12,6 +12,12 @@ if exists('g:loaded_nuwiki') endif let g:loaded_nuwiki = 1 +" Plugin version, surfaced by :VimwikiShowVersion / :NuwikiShowVersion. +" Set before the Neovim early-return below so both clients see the global. +if !exists('g:nuwiki_version') + let g:nuwiki_version = '0.1.0' +endif + " Resolve the plugin root NOW, while this script is being sourced and " is still valid. Commands that need this path must reference " s:plugin_root — re-expanding inside a command body evaluates @@ -47,6 +53,10 @@ augroup END command! -nargs=0 VimwikiUISelect call nuwiki#commands#wiki_ui_select() command! -nargs=0 NuwikiUISelect call nuwiki#commands#wiki_ui_select() +" Print the nuwiki version + host editor (upstream's :VimwikiShowVersion). +command! -nargs=0 VimwikiShowVersion call nuwiki#commands#show_version() +command! -nargs=0 NuwikiShowVersion call nuwiki#commands#show_version() + " Global entry-point mappings — work from any buffer, not just .wiki files. " Files are opened directly from config (no LSP required); the server " auto-starts via the FileType autocmd once the vimwiki buffer loads.