parity(1): vimwiki per-wiki config keys, table colspan/rowspan,
named link commands, mouse maps
Parity audit Cluster 1 — small wins.
WikiConfig (server) extended with 14 vimwiki globals:
- `index` (`g:vimwiki_index`), wired into `:VimwikiIndex` so users
with a custom index page stem (e.g. `home`) get the right file.
- `diary_frequency`, `diary_start_week_day`, `diary_caption_level`,
`diary_sort`, `diary_header` — diary keys (weekly/monthly/yearly
semantics land in Cluster 4; the keys parse now so config
migration doesn't need to wait).
- `maxhi`, `listsyms`, `listsyms_propagate`, `list_margin`,
`links_space_char`, `nested_syntaxes`, `auto_toc` — list +
highlight knobs the renderer/handlers can consult.
All keys threaded through `RawWiki` → `WikiConfig::from(RawWiki)`,
defaults centralised in `wiki_defaults()` so `empty()`, `from_root()`,
the legacy single-wiki path, and the `RawWiki` impl stay in sync.
Lua front-door (`lua/nuwiki/config.lua`) now documents the multi-wiki
`wikis = {…}` shape with every accepted per-wiki key — users who
prefer Lua tables no longer have to round-trip through
`init_options` raw JSON.
HTML renderer (`crates/nuwiki-core/src/render/html.rs`):
- New `table_spans()` pre-pass resolves vimwiki's `>` (col_span) and
`\\/` (row_span) continuation markers into proper HTML
`colspan="N"` / `rowspan="N"` attributes on the lead cell. Continuation
cells emit nothing, matching what browsers expect.
- The old behaviour (emitting `class="col-span"` / `class="row-span"`
as visual markers) is gone — replaced with real merging so the
rendered HTML matches the source semantics.
Named ex-commands:
- `:VimwikiNextLink` / `:VimwikiPrevLink` — were keymapped only
(`<Tab>`/`<S-Tab>`); now have explicit `:` commands in both editor
paths, dispatching to new `nuwiki.commands.link_next` / `link_prev`
pure-Vim/Lua helpers.
- `:VimwikiBaddLink` — adds the link target's file to the buffer
list without switching focus. Goes through
`textDocument/definition` and runs `:badd <fname>` on the resolved
URI.
Mouse maps (opt-in via `mappings.mouse = true` in Lua or
`g:nuwiki_mouse_mappings = 1` in Vim):
- `<2-LeftMouse>` follows, `<S-2-LeftMouse>` / `<C-2-LeftMouse>`
follow in split/vsplit, `<MiddleMouse>` adds to buflist,
`<RightMouse>` goes back. Mirrors upstream vimwiki's defaults.
Tests: 7 new in `parity_cluster_1.rs` covering the per-wiki config
defaults + raw JSON parse, the legacy-single-wiki path, colspan
folding into a lead cell with no leftover class markers, rowspan
across rows, no-attrs when the table has no spans, and a sanity
paragraph render. Total 421 Rust tests pass; clippy clean; both
keymap harnesses still green (20 nvim + 12 vim).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,9 @@ if !has('nvim')
|
||||
command! -buffer VimwikiFollowLink LspDefinition
|
||||
command! -buffer VimwikiBacklinks LspReferences
|
||||
command! -buffer VWB LspReferences
|
||||
command! -buffer VimwikiNextLink call nuwiki#commands#link_next()
|
||||
command! -buffer VimwikiPrevLink call nuwiki#commands#link_prev()
|
||||
command! -buffer VimwikiBaddLink call nuwiki#commands#badd_link()
|
||||
command! -buffer -nargs=1 VimwikiSearch lvimgrep /<args>/ **
|
||||
command! -buffer -nargs=1 VWS lvimgrep /<args>/ **
|
||||
command! -buffer -nargs=1 VimwikiGoto call nuwiki#commands#wiki_goto_page(<q-args>)
|
||||
@@ -181,6 +184,15 @@ if !has('nvim')
|
||||
nnoremap <silent><buffer> <Leader>whh :call nuwiki#commands#export_browse()<CR>
|
||||
nnoremap <silent><buffer> <Leader>wha :call nuwiki#commands#export_all()<CR>
|
||||
|
||||
" Mouse (opt-in via g:nuwiki_mouse_mappings = 1).
|
||||
if get(g:, 'nuwiki_mouse_mappings', 0)
|
||||
nnoremap <silent><buffer> <2-LeftMouse> :call nuwiki#commands#follow_link_or_create()<CR>
|
||||
nnoremap <silent><buffer> <S-2-LeftMouse> :split<CR>:call nuwiki#commands#follow_link_or_create()<CR>
|
||||
nnoremap <silent><buffer> <C-2-LeftMouse> :vsplit<CR>:call nuwiki#commands#follow_link_or_create()<CR>
|
||||
nnoremap <silent><buffer> <MiddleMouse> :call nuwiki#commands#badd_link()<CR>
|
||||
nnoremap <silent><buffer> <RightMouse> <C-o>
|
||||
endif
|
||||
|
||||
" Tables
|
||||
nnoremap <silent><buffer> gqq :call nuwiki#commands#table_align()<CR>
|
||||
nnoremap <silent><buffer> gq1 :call nuwiki#commands#table_align()<CR>
|
||||
@@ -216,6 +228,9 @@ command! -buffer VimwikiSplitLink split | lua vim.lsp.buf.definition()
|
||||
command! -buffer VimwikiVSplitLink vsplit | lua vim.lsp.buf.definition()
|
||||
command! -buffer VimwikiTabnewLink tabnew | lua vim.lsp.buf.definition()
|
||||
command! -buffer VimwikiTabDropLink tabnew | lua vim.lsp.buf.definition()
|
||||
command! -buffer VimwikiNextLink lua require('nuwiki.commands').link_next()
|
||||
command! -buffer VimwikiPrevLink lua require('nuwiki.commands').link_prev()
|
||||
command! -buffer VimwikiBaddLink lua require('nuwiki.commands').badd_link()
|
||||
command! -buffer -nargs=1 VimwikiGoto lua require('nuwiki.commands').wiki_goto_page(<q-args>)
|
||||
command! -buffer VimwikiBacklinks lua vim.lsp.buf.references()
|
||||
command! -buffer VWB lua vim.lsp.buf.references()
|
||||
|
||||
Reference in New Issue
Block a user