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 <noreply@anthropic.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
+28
-6
@@ -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(<q-args>)
|
||||
command! -buffer -nargs=? VimwikiGenerateTagLinks call nuwiki#commands#tags_generate_links(<q-args>)
|
||||
|
||||
" 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(<count>)
|
||||
command! -buffer -count NuwikiTabIndex call nuwiki#commands#wiki_tab_index(<count>)
|
||||
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 <bang>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(<q-args>)
|
||||
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(<q-args>)
|
||||
command! -buffer -nargs=? VimwikiGenerateTagLinks lua require('nuwiki.commands').tags_generate_links(<q-args>)
|
||||
|
||||
" 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 (<bang>0 ? "lua require('nuwiki.commands').export_all_force()" : "lua require('nuwiki.commands').export_all()")
|
||||
|
||||
command! -buffer NuwikiGoBackLink execute "normal! \<C-o>"
|
||||
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)
|
||||
|
||||
@@ -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<Space>` — remove done items from the current list only. Passing the
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
-- text_objects = true, -- ah, ih, al, il
|
||||
-- wiki_prefix = true, -- <Leader>ww, <Leader>ws, <Leader>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)
|
||||
|
||||
Reference in New Issue
Block a user