Major clean up and improvements to vimwiki compatibility and documentation.
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
+19
-6
@@ -1,5 +1,5 @@
|
||||
-- lua/nuwiki/commands.lua — Lua wrappers around every `nuwiki.*`
|
||||
-- `workspace/executeCommand` the server advertises. Phase 19 plumbing.
|
||||
-- `workspace/executeCommand` the server advertises.
|
||||
--
|
||||
-- Each public function is named after its `:Vimwiki*` / `:Nuwiki*`
|
||||
-- counterpart so `ftplugin/nuwiki.vim` can wire them up declaratively.
|
||||
@@ -323,6 +323,12 @@ end
|
||||
|
||||
M.toggle_list_item = _exec_pos('nuwiki.list.toggleCheckbox')
|
||||
M.cycle_list_item = _exec_pos('nuwiki.list.cycleCheckbox')
|
||||
-- `glp` cycles backward — same command, `reverse = true` in the payload.
|
||||
function M.cycle_list_item_back()
|
||||
local a = pos_args()
|
||||
a[1].reverse = true
|
||||
exec('nuwiki.list.cycleCheckbox', a)
|
||||
end
|
||||
M.reject_list_item = _exec_pos('nuwiki.list.rejectCheckbox')
|
||||
M.heading_add_level = _exec_pos('nuwiki.heading.addLevel')
|
||||
M.heading_remove_level = _exec_pos('nuwiki.heading.removeLevel')
|
||||
@@ -462,7 +468,7 @@ function M.rename_file()
|
||||
vim.lsp.buf.rename()
|
||||
end
|
||||
|
||||
-- ===== Deferred placeholders (§13.1) =====
|
||||
-- ===== 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
|
||||
@@ -471,15 +477,22 @@ end
|
||||
local function _not_yet(name)
|
||||
return function()
|
||||
vim.notify(
|
||||
'nuwiki: ' .. name .. ' is not yet implemented — see SPEC §13.1',
|
||||
'nuwiki: ' .. name .. ' is not yet implemented',
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- §13.1 Cluster A — list rewriters.
|
||||
-- Cluster A — list rewriters.
|
||||
|
||||
-- `gl<Space>` — remove done items from the current list only. Passing the
|
||||
-- cursor position scopes the server to the contiguous list block under it.
|
||||
function M.list_remove_done()
|
||||
exec('nuwiki.list.removeDone', pos_args())
|
||||
end
|
||||
|
||||
-- `gL<Space>` — remove done items across the whole buffer (no position).
|
||||
function M.list_remove_done_all()
|
||||
exec('nuwiki.list.removeDone', uri_args())
|
||||
end
|
||||
|
||||
@@ -878,7 +891,7 @@ function M.smart_shift_tab()
|
||||
)
|
||||
end
|
||||
|
||||
-- §13.1 Cluster B — table rewriters.
|
||||
-- Cluster B — table rewriters.
|
||||
|
||||
function M.table_insert(cols, rows)
|
||||
cols = tonumber(cols) or 3
|
||||
@@ -961,7 +974,7 @@ function M.colorize(color)
|
||||
vim.api.nvim_buf_set_lines(0, row - 1, row, false, { new_line })
|
||||
end
|
||||
|
||||
-- §13.1 Cluster C — link helpers.
|
||||
-- Cluster C — link helpers.
|
||||
|
||||
function M.paste_link()
|
||||
exec('nuwiki.link.pasteWikilink', pos_args())
|
||||
|
||||
Reference in New Issue
Block a user