From cd9d587aaba4fa4abb0d7d74ea6cdb92066c2c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Sat, 30 May 2026 15:54:05 -0300 Subject: [PATCH] Add missing :Nuwiki* aliases and drop dead deferred-stub code Every :Vimwiki* command now has a canonical :Nuwiki* counterpart (tables, colorize, clipboard paste, list-level/remove-done, and the Neovim-only split/tab link-follow variants). Remove the now-unused "not yet implemented" stub helpers (_not_yet, deferred, s:notify_deferred) and the stale "deferred" comments, since every command is implemented and server-backed. Co-Authored-By: Claude Opus 4.7 --- autoload/nuwiki/commands.vim | 8 +------- ftplugin/vimwiki.vim | 34 ++++++++++++++++++++++++++++------ lua/nuwiki/commands.lua | 15 --------------- lua/nuwiki/keymaps.lua | 15 --------------- 4 files changed, 29 insertions(+), 43 deletions(-) diff --git a/autoload/nuwiki/commands.vim b/autoload/nuwiki/commands.vim index 7908023..df9c927 100644 --- a/autoload/nuwiki/commands.vim +++ b/autoload/nuwiki/commands.vim @@ -105,12 +105,6 @@ function! s:open_uri_from(response, ...) abort execute l:cmd . ' ' . fnameescape(l:path) endfunction -function! s:notify_deferred(name) abort - echohl WarningMsg - echom 'nuwiki: ' . a:name . ' is not yet implemented' - echohl None -endfunction - " ===== Wiki picker ===== function! nuwiki#commands#wiki_index(count) abort @@ -634,7 +628,7 @@ function! nuwiki#commands#rename_file() abort endif endfunction -" ===== Deferred ===== +" ===== List, table & clipboard commands ===== " Cluster A — list rewriters. diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index c181218..06c4f13 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -2,9 +2,8 @@ " " Wires up: " - basic edit-time options (commentstring, suffixesadd, …) -" - every `:Vimwiki*` / `:Nuwiki*` command that has a -" server-side counterpart (deferred commands stub out with a -" "not yet implemented" notification) +" - every `:Vimwiki*` / `:Nuwiki*` command, dispatching to the +" server (or a pure client-side helper for the few that need one) " - on Neovim: keymaps + text objects + folding via " `nuwiki.ftplugin.attach()` @@ -78,7 +77,7 @@ if !has('nvim') command! -buffer -nargs=? VimwikiSearchTags call nuwiki#commands#tags_search() command! -buffer -nargs=? VimwikiGenerateTagLinks call nuwiki#commands#tags_generate_links() - " Deferred stubs. + " 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() @@ -86,7 +85,7 @@ if !has('nvim') command! -buffer VimwikiPasteLink call nuwiki#commands#paste_link() command! -buffer VimwikiPasteUrl call nuwiki#commands#paste_url() - " :Nuwiki* canonical aliases (P10) — Vim side. + " :Nuwiki* canonical aliases — Vim side. command! -buffer -count NuwikiIndex call nuwiki#commands#wiki_index() command! -buffer -count NuwikiTabIndex call nuwiki#commands#wiki_tab_index() command! -buffer NuwikiDiaryIndex call nuwiki#commands#diary_index() @@ -130,6 +129,15 @@ if !has('nvim') command! -buffer Nuwiki2HTMLBrowse call nuwiki#commands#export_browse() command! -buffer -bang NuwikiAll2HTML if 0 | call nuwiki#commands#export_all_force() | else | call nuwiki#commands#export_all() | endif + command! -buffer NuwikiRemoveDone call nuwiki#commands#list_remove_done() + command! -buffer -nargs=? NuwikiListChangeLvl call nuwiki#commands#list_change_lvl() + 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 NuwikiColorize call nuwiki#commands#colorize() + command! -buffer NuwikiPasteLink call nuwiki#commands#paste_link() + command! -buffer NuwikiPasteUrl call nuwiki#commands#paste_url() + " ===== Default key mappings (parity with upstream vimwiki) ===== " " Users can opt out by setting `g:nuwiki_no_default_mappings = 1` @@ -331,7 +339,7 @@ command! -buffer VimwikiRebuildTags lua require('nuwiki.commands'). command! -buffer -nargs=? VimwikiSearchTags lua require('nuwiki.commands').tags_search() command! -buffer -nargs=? VimwikiGenerateTagLinks lua require('nuwiki.commands').tags_generate_links() -" Deferred — stubs notify the user instead of erroring. +" Tables, colorize, and clipboard paste. 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() @@ -384,5 +392,19 @@ command! -buffer Nuwiki2HTML lua require('nuwiki.command command! -buffer Nuwiki2HTMLBrowse lua require('nuwiki.commands').export_browse() command! -buffer -bang NuwikiAll2HTML execute (0 ? "lua require('nuwiki.commands').export_all_force()" : "lua require('nuwiki.commands').export_all()") +command! -buffer NuwikiGoBackLink execute "normal! \" +command! -buffer NuwikiSplitLink split | lua vim.lsp.buf.definition() +command! -buffer NuwikiVSplitLink vsplit | lua vim.lsp.buf.definition() +command! -buffer NuwikiTabnewLink tabnew | lua vim.lsp.buf.definition() +command! -buffer NuwikiTabDropLink tabnew | lua vim.lsp.buf.definition() +command! -buffer NuwikiRemoveDone lua require('nuwiki.commands').list_remove_done() +command! -buffer -nargs=? NuwikiListChangeLvl lua require('nuwiki.commands').list_change_lvl() +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 NuwikiColorize lua require('nuwiki.commands').colorize() +command! -buffer NuwikiPasteLink lua require('nuwiki.commands').paste_link() +command! -buffer NuwikiPasteUrl lua require('nuwiki.commands').paste_url() + " Buffer attach: keymaps + text objects + folding. lua require('nuwiki.ftplugin').attach(0) diff --git a/lua/nuwiki/commands.lua b/lua/nuwiki/commands.lua index 1b65206..ceaa737 100644 --- a/lua/nuwiki/commands.lua +++ b/lua/nuwiki/commands.lua @@ -468,21 +468,6 @@ function M.rename_file() vim.lsp.buf.rename() end --- ===== Deferred placeholders ===== --- --- These commands aren't implemented on the server yet. Stub them so the --- `:Vimwiki*` compat surface exists and users get a clear message --- instead of "unknown command". - -local function _not_yet(name) - return function() - vim.notify( - 'nuwiki: ' .. name .. ' is not yet implemented', - vim.log.levels.WARN - ) - end -end - -- Cluster A — list rewriters. -- `gl` — remove done items from the current list only. Passing the diff --git a/lua/nuwiki/keymaps.lua b/lua/nuwiki/keymaps.lua index d10a662..1b1c8fb 100644 --- a/lua/nuwiki/keymaps.lua +++ b/lua/nuwiki/keymaps.lua @@ -15,10 +15,6 @@ -- text_objects = true, -- ah, ih, al, il -- wiki_prefix = true, -- ww, ws, wi, … -- } --- --- Mappings that point at deferred commands stub out to a --- "not yet implemented" notification — better than a silent no-op --- so users get parity *signalling*, not just parity in lhs. local M = {} @@ -133,17 +129,6 @@ local function open_above_with_bullet() vim.api.nvim_feedkeys('O' .. prefix, 'n', false) end --- ===== Stub for deferred commands ===== - -local function deferred(name) - return function() - vim.notify( - 'nuwiki: ' .. name .. ' is not yet implemented', - vim.log.levels.WARN - ) - end -end - -- ===== Public attach ===== function M.attach(bufnr, mappings)