feat(config): P3 config batch — group 1 (clean config + plumbing)

Config plumbing for the whole config batch (HtmlConfig + WikiConfig fields,
RawWiki deserialization, From/defaults) plus these behaviors:

- rss_name / rss_max_items: HtmlConfig fields (wired into write_rss in the RSS
  group).
- toc_link_format: build_toc_text emits [[#anchor]] (no description) for 1,
  [[#anchor|title]] for 0.
- generated_links_caption: build_links_text emits [[page|FirstHeading]] from a
  page->heading map (ops::page_captions) when enabled.
- table_reduce_last_col: column_widths clamps the last column to width 1 when
  set; threaded through table_align_edit/table_move_column_edit + commands.
- color_dic now ships a populated default palette (red/green/blue/...).
- commentstring aligned to upstream's no-space `%%%s`.
- auto_chdir (default off): :lcd into the owning wiki root on buffer enter;
  both clients (ftplugin.lua setup_auto_chdir + Vim NuwikiAutoChdir augroup),
  with config.wiki_root_for / nuwiki#commands#wiki_root_for resolvers.

Also seeded HtmlConfig fields for later groups (valid_html_tags,
list/text_ignore_newline, emoji_enable, user_htmls, color_tag_template) and
WikiConfig (create_link, dir_link, bullet_types, cycle_bullets).

Tests: toc_link_format, generated_links_caption, table_reduce_last_col,
config defaults + JSON round-trip for every new key. Full rust suite +
both keymap harnesses green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-03 12:04:36 +00:00
parent 03005d0931
commit b2f2fc88bd
11 changed files with 522 additions and 48 deletions
+11 -1
View File
@@ -12,7 +12,8 @@ if exists('b:did_ftplugin')
endif
let b:did_ftplugin = 1
setlocal commentstring=%%\ %s
" vimwiki's commentstring is `%%%s` (no space); match it exactly.
setlocal commentstring=%%%s
setlocal comments=:%%
setlocal formatoptions+=ron
setlocal suffixesadd=.wiki
@@ -62,6 +63,15 @@ if !has('nvim')
augroup END
let b:undo_ftplugin .= ' | execute "autocmd! NuwikiTableAutoFmt * <buffer>"'
endif
" vimwiki `auto_chdir` (default off): lcd into the owning wiki's root.
if get(g:, 'nuwiki_auto_chdir', 0)
augroup NuwikiAutoChdir
autocmd! * <buffer>
autocmd BufEnter,BufWinEnter <buffer> call nuwiki#commands#auto_chdir()
augroup END
call nuwiki#commands#auto_chdir()
let b:undo_ftplugin .= ' | execute "autocmd! NuwikiAutoChdir * <buffer>"'
endif
endif
if !has('nvim')