9e6faa5554
The Phase 19 keymap layer only covered the high-value subset and used `g=`/`g-` instead of vimwiki's `=`/`-` for header levels. Users reporting "mappings don't seem to be working" were either on the Vim path (which registered zero keymaps) or hitting bindings that don't exist (e.g. `<Tab>`, `<S-CR>`, `gll`, `gqq`). Cross-referenced upstream vimwiki/ftplugin/vimwiki.vim and rewired both `lua/nuwiki/keymaps.lua` and `ftplugin/vimwiki.vim` (Vim path) to match its default surface. Mappings backed by commands that exist on the server dispatch directly; §13.1-deferred mappings register with the same lhs but stub out to a notification — so users get parity *signalling*, not silence. New on Neovim (and matched on Vim where possible): Links group: - `<S-CR>` / `<C-CR>` / `<C-S-CR>` — follow in split / vsplit / tab - `<Tab>` / `<S-Tab>` — jump to next / prev `[[…]]` (pure Lua search) - `+` (n + x) — :VimwikiNormalizeLink stub - `<Leader>wc` (n + x) — :VimwikiColorize stub Lists group: - `<C-@>` (n + x) — terminal-alt for `<C-Space>` - `gln` / `glp` increment + decrement (deferred backward; same fn for now) - `glh` / `gll` / `gLh` / `gLl` — list level stubs - `glr` / `gLr` — list renumber stubs - `gl<Space>` / `gL<Space>` — checkbox remove stubs - `o` / `O` — open below/above and continue the bullet (pure Lua) - visual-mode variants of `<C-Space>`, `gln`, `glp`, `glx` Header group (key group, now buffer-local): - `=` / `-` — promote / demote (was `g=`/`g-`, matched to vimwiki) - `]]` / `[[` — next / prev header (pure Lua) - `]=` / `[=` — next / prev sibling header (pure Lua) - `]u` / `[u` — parent header (pure Lua) Table group: `gqq`, `gq1`, `gww`, `gw1`, `<A-Left>`, `<A-Right>` stubs. Wiki prefix: `<Leader>w<Leader>m` (vimwiki's tomorrow), `<Leader>w<Leader>i` (rebuild diary index). Config schema (`config.options.mappings`) updates to vimwiki's group names — `links` / `lists` / `headers` / `table_editing` / `diary` / `html_export` / `text_objects` / `wiki_prefix`. Old names (`list_editing` / `header_nav`) are retired; rename only — keeps the opt-out shape intact. Vim path: same set ported to buffer-local VimL maps. `g:nuwiki_no_default_mappings` opts out the whole layer for users who prefer their own bindings. Lua side uses the Neovim 0.11+ `vim.keymap.set` API; both call straight into the same `nuwiki#commands#…` autoload (Vim) / `nuwiki.commands` (Lua) layer that drives the LSP. Total 377 tests still pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
42 lines
1.3 KiB
Lua
42 lines
1.3 KiB
Lua
-- lua/nuwiki/config.lua — defaults and user-config merge.
|
|
--
|
|
-- Schema mirrors SPEC §7.5 + §12.11. Keep this aligned with
|
|
-- `doc/nuwiki.txt`.
|
|
|
|
local M = {}
|
|
|
|
M.defaults = {
|
|
wiki_root = '~/vimwiki',
|
|
file_extension = '.wiki',
|
|
syntax = 'vimwiki',
|
|
log_level = 'warn',
|
|
|
|
-- 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.
|
|
mappings = {
|
|
enabled = true,
|
|
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
|
|
text_objects = true, -- ah, ih, …
|
|
},
|
|
|
|
-- 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',
|
|
}
|
|
|
|
M.options = vim.deepcopy(M.defaults)
|
|
|
|
function M.apply(user)
|
|
M.options = vim.tbl_deep_extend('force', M.defaults, user or {})
|
|
end
|
|
|
|
return M
|