Files
nuwiki/autoload/vimwiki/vars.vim
T
gffranco 3b92b11948
CI / cargo fmt --check (push) Successful in 20s
CI / cargo clippy (push) Successful in 32s
CI / cargo test (push) Successful in 38s
CI / editor keymaps (push) Successful in 1m33s
fix(review): close all 2026-06-03 codebase-review findings (R1-R18)
Resolves the 18 findings from the parallel codebase review, tracked in
development/vimwiki-gap.md.

Correctness / perf:
- Wiki.config -> Arc<WikiConfig> so cloning a Wiki is a refcount bump (R5)
- WorkspaceIndex::remove is no longer O(n^2): a per-source contributions
  map limits the scan to buckets the source actually wrote into (R6)
- render_color now expands color_tag_template (__STYLE__/__CONTENT__),
  consuming the previously-dead field; ColorNode documented as an
  extension point; 3 renderer tests added (R3/R4)
- wiki_root_for returns empty/nil on no-match instead of falling back to
  the first wiki (R2); auto_header honours links_space_char (R7)

Cleanup / dedup:
- Remove dead #[allow(dead_code)] stubs + uncalled pub helpers, narrow
  imports (R10/R11)
- Dedup span_of_inline x3 -> InlineNode::span() (R12)
- diary_step single read lock; page_captions single pass (R13)
- Lua auto_header loop -> wiki_list(); detect_current_symbol cleanup
  (R14/R18)

Client / docs:
- :VimwikiNormalizeLink Vim cmds -> <q-args> (R17); ftplugin header fix
  (R16); vars.vim multi-wiki limitation documented (R15)
- Document 19 config options in README.md + doc/nuwiki.txt; fix
  list_margin/shiftwidth doc and stale comments (R1/R9)
- R8 investigated, confirmed not a real bug (documented)

Verified: Neovim harness 307, Vim harness 301/18/21, Rust suite 568, all
0 failed; clippy clean; fresh parallel-agent audit found no regressions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 14:13:55 +00:00

48 lines
1.8 KiB
VimL

" autoload/vimwiki/vars.vim — compatibility shim for plugins that depend on
" the original vimwiki API (e.g. vimwiki-sync, vim-zettel).
"
" Only the subset of `vimwiki#vars#get_wikilocal` keys that third-party
" plugins are known to call is implemented here; add entries as needed.
" Values are read from nuwiki's own config variables so users don't have
" to duplicate settings.
" Per-wiki local config values.
"
" Supported keys:
" path — wiki root directory (with trailing slash)
" is_temporary_wiki — always 0 for a configured wiki
" ext / extension — file extension (default '.wiki')
" syntax — syntax name (default 'vimwiki')
"
" LIMITATION: the optional second argument (upstream's wiki index) is
" ignored — values always come from the scalar `g:nuwiki_*` vars, i.e.
" the first/shorthand wiki. Third-party plugins that query a specific
" wiki by index in a multi-wiki setup will get the first wiki's values.
" The shim exists for single-wiki compatibility (vimwiki-sync, vim-zettel);
" extend here with `g:nuwiki_wikis[a:1]` lookups if multi-wiki support is
" needed.
function! vimwiki#vars#get_wikilocal(key, ...) abort
if a:key ==# 'path'
let l:root = expand(get(g:, 'nuwiki_wiki_root', '~/vimwiki'))
" Ensure trailing slash to match what the original vimwiki returns.
return l:root =~# '/$' ? l:root : l:root . '/'
elseif a:key ==# 'is_temporary_wiki'
return 0
elseif a:key ==# 'ext' || a:key ==# 'extension'
let l:ext = get(g:, 'nuwiki_file_extension', '.wiki')
return l:ext[0] ==# '.' ? l:ext : '.' . l:ext
elseif a:key ==# 'syntax'
return get(g:, 'nuwiki_syntax', 'vimwiki')
endif
return ''
endfunction
" Global (non-wiki-specific) config values.
function! vimwiki#vars#get_global(key) abort
return ''
endfunction