Major clean up and improvements to vimwiki compatibility and documentation.
CI / cargo fmt --check (push) Successful in 33s
CI / cargo clippy (push) Successful in 23s
CI / cargo test (push) Successful in 33s
CI / editor keymaps (push) Successful in 1m25s

Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2026-05-30 18:35:40 +00:00
parent 95645a2b91
commit 8ab6015405
71 changed files with 2496 additions and 1914 deletions
+19 -6
View File
@@ -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())
+7 -8
View File
@@ -1,12 +1,11 @@
-- lua/nuwiki/config.lua — defaults and user-config merge.
--
-- Schema mirrors SPEC §7.5 + §12.11. Keep this aligned with
-- `doc/nuwiki.txt`.
-- Keep this aligned with `doc/nuwiki.txt`.
local M = {}
M.defaults = {
-- v1.0 single-wiki shorthand. The server desugars these into a
-- Single-wiki shorthand. The server desugars these into a
-- one-entry `wikis = {…}` list. Use either this or the multi-wiki
-- form below; if both are set, `wikis` wins.
wiki_root = '~/vimwiki',
@@ -14,12 +13,12 @@ M.defaults = {
syntax = 'vimwiki',
log_level = 'warn',
-- v1.1 multi-wiki shape. Each entry honours every per-wiki key the
-- Multi-wiki shape. Each entry honours every per-wiki key the
-- server understands. Leave nil to fall through to the shorthand
-- above.
--
-- Per-wiki keys (all optional, server defaults documented in SPEC
-- §12.11):
-- Per-wiki keys (all optional, server defaults documented in
-- `doc/nuwiki.txt`):
-- name, root, file_extension, syntax, index
-- diary_rel_path, diary_index, diary_frequency,
-- diary_start_week_day, diary_caption_level, diary_sort,
@@ -31,7 +30,7 @@ M.defaults = {
-- links_space_char, nested_syntaxes
wikis = nil,
-- Phase 19: per-buffer glue. Each subgroup mirrors vimwiki's
-- Per-buffer glue. Each subgroup mirrors vimwiki's
-- `g:vimwiki_key_mappings` shape and can be flipped off
-- independently to suppress that group of keymaps.
mappings = {
@@ -47,7 +46,7 @@ M.defaults = {
mouse = false, -- <2-LeftMouse>, <RightMouse>, … (opt-in)
},
-- Phase 19: folding. `'lsp'` uses the server's `foldingRange`
-- Folding. `'lsp'` uses the server's `foldingRange`
-- provider (Neovim 0.11+ wires it automatically). `'expr'` falls
-- back to a regex-based `foldexpr`. `'off'` skips folding setup.
folding = 'lsp',
+2 -2
View File
@@ -1,6 +1,6 @@
-- lua/nuwiki/ftplugin.lua — per-buffer hookup invoked by
-- `ftplugin/nuwiki.vim`. Centralises the Lua side of Phase 19 so the
-- VimL ftplugin stays a one-liner regardless of which subgroups are
-- `ftplugin/nuwiki.vim`. Centralises the Lua side of the per-buffer
-- glue so the VimL ftplugin stays a one-liner regardless of which subgroups are
-- enabled.
local M = {}
+2 -2
View File
@@ -1,7 +1,7 @@
-- lua/nuwiki/health.lua — `:checkhealth nuwiki` target.
--
-- v1.0 checks per SPEC §7.6 (binary, version, filetype, LSP attach).
-- v1.1 §12.10 additions: registered LSP commands, indexed wikis, HTML
-- Core checks: binary, version, filetype, LSP attach.
-- Additional checks: registered LSP commands, indexed wikis, HTML
-- output path writability, default keymaps installed.
local M = {}
+1 -1
View File
@@ -5,7 +5,7 @@
-- require('nuwiki').install() — install / build the language server
-- require('nuwiki').health() — :checkhealth nuwiki target
--
-- Per SPEC §6.2/§6.3 this layer is wiring only. Everything substantive
-- This layer is wiring only. Everything substantive
-- happens in the Rust language server.
local M = {}
+1 -1
View File
@@ -1,6 +1,6 @@
-- lua/nuwiki/install.lua — install / build the `nuwiki-ls` binary.
--
-- Strategy (matches SPEC §7.2):
-- Strategy:
-- 1. Look for `bin/nuwiki-ls[.exe]` next to the plugin.
-- 2. If missing or `g:nuwiki_build_from_source` is set, build with cargo.
-- 3. Otherwise try to download a release asset for the current target.
+7 -7
View File
@@ -16,7 +16,7 @@
-- wiki_prefix = true, -- <Leader>ww, <Leader>ws, <Leader>wi, …
-- }
--
-- Mappings that point at §13.1-deferred commands stub out to a
-- 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.
@@ -133,12 +133,12 @@ local function open_above_with_bullet()
vim.api.nvim_feedkeys('O' .. prefix, 'n', false)
end
-- ===== Stub for deferred §13.1 commands =====
-- ===== Stub for deferred commands =====
local function deferred(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
@@ -218,8 +218,8 @@ function M.attach(bufnr, mappings)
map('n', 'gnt', cmd.next_task, { desc = 'nuwiki: next unfinished task' }, bufnr)
map('n', 'gln', cmd.cycle_list_item, { desc = 'nuwiki: increment checkbox' }, bufnr)
map('x', 'gln', cmd.cycle_list_item, { desc = 'nuwiki: increment checkbox' }, bufnr)
map('n', 'glp', cmd.cycle_list_item, { desc = 'nuwiki: decrement checkbox' }, bufnr)
map('x', 'glp', cmd.cycle_list_item, { desc = 'nuwiki: decrement checkbox' }, bufnr)
map('n', 'glp', cmd.cycle_list_item_back, { desc = 'nuwiki: decrement checkbox' }, bufnr)
map('x', 'glp', cmd.cycle_list_item_back, { desc = 'nuwiki: decrement checkbox' }, bufnr)
map('n', 'glx', cmd.reject_list_item, { desc = 'nuwiki: reject checkbox' }, bufnr)
map('x', 'glx', cmd.reject_list_item, { desc = 'nuwiki: reject checkbox' }, bufnr)
map('n', 'glh', function() cmd.list_change_level(-1, false) end,
@@ -235,8 +235,8 @@ function M.attach(bufnr, mappings)
map('n', 'gLr', cmd.list_renumber_all,
{ desc = 'nuwiki: renumber all lists' }, bufnr)
map('n', 'gl<Space>', cmd.list_remove_done,
{ desc = 'nuwiki: remove done items' }, bufnr)
map('n', 'gL<Space>', cmd.list_remove_done,
{ desc = 'nuwiki: remove done items (current list)' }, bufnr)
map('n', 'gL<Space>', cmd.list_remove_done_all,
{ desc = 'nuwiki: remove done items (whole doc)' }, bufnr)
map('n', 'o', open_below_with_bullet, { desc = 'nuwiki: open below + bullet' }, bufnr)
map('n', 'O', open_above_with_bullet, { desc = 'nuwiki: open above + bullet' }, bufnr)