2026-05-11 00:38:09 +00:00
|
|
|
-- lua/nuwiki/config.lua — defaults and user-config merge.
|
|
|
|
|
--
|
2026-05-11 21:57:05 +00:00
|
|
|
-- Schema mirrors SPEC §7.5 + §12.11. Keep this aligned with
|
|
|
|
|
-- `doc/nuwiki.txt`.
|
2026-05-10 16:01:58 +00:00
|
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
2026-05-11 00:38:09 +00:00
|
|
|
M.defaults = {
|
2026-05-12 15:10:27 +00:00
|
|
|
-- v1.0 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.
|
2026-05-11 00:38:09 +00:00
|
|
|
wiki_root = '~/vimwiki',
|
|
|
|
|
file_extension = '.wiki',
|
|
|
|
|
syntax = 'vimwiki',
|
|
|
|
|
log_level = 'warn',
|
2026-05-11 21:57:05 +00:00
|
|
|
|
2026-05-12 15:10:27 +00:00
|
|
|
-- v1.1 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):
|
|
|
|
|
-- name, root, file_extension, syntax, index
|
|
|
|
|
-- diary_rel_path, diary_index, diary_frequency,
|
|
|
|
|
-- diary_start_week_day, diary_caption_level, diary_sort,
|
|
|
|
|
-- diary_header
|
|
|
|
|
-- html_path, template_path, template_default, template_ext,
|
|
|
|
|
-- template_date_format, css_name, auto_export, auto_toc,
|
|
|
|
|
-- html_filename_parameterization, exclude_files, color_dic
|
|
|
|
|
-- maxhi, listsyms, listsyms_propagate, list_margin,
|
|
|
|
|
-- links_space_char, nested_syntaxes
|
|
|
|
|
wikis = nil,
|
|
|
|
|
|
2026-05-12 00:46:40 +00:00
|
|
|
-- Phase 19: 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.
|
2026-05-11 21:57:05 +00:00
|
|
|
mappings = {
|
|
|
|
|
enabled = true,
|
2026-05-12 00:46:40 +00:00
|
|
|
wiki_prefix = true, -- <Leader>w*
|
|
|
|
|
links = true, -- <CR>, <S-CR>, <Tab>, <BS>, +, …
|
|
|
|
|
lists = true, -- <C-Space>, gln/glp/glx, gl<Space>, o/O, …
|
|
|
|
|
headers = true, -- =, -, ]], [[, ]=, [=, ]u, [u
|
|
|
|
|
table_editing = true, -- gqq, gq1, gww, gw1, <A-Left>, <A-Right>
|
|
|
|
|
diary = true, -- <C-Down>, <C-Up>
|
|
|
|
|
html_export = true, -- <Leader>wh, <Leader>whh
|
2026-05-12 15:10:27 +00:00
|
|
|
text_objects = true, -- ah, ih, aH, iH, al, il, a\, i\, ac, ic
|
|
|
|
|
mouse = false, -- <2-LeftMouse>, <RightMouse>, … (opt-in)
|
2026-05-11 21:57:05 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- Phase 19: 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',
|
2026-05-11 00:38:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
M.options = vim.deepcopy(M.defaults)
|
|
|
|
|
|
|
|
|
|
function M.apply(user)
|
|
|
|
|
M.options = vim.tbl_deep_extend('force', M.defaults, user or {})
|
|
|
|
|
end
|
|
|
|
|
|
2026-05-10 16:01:58 +00:00
|
|
|
return M
|