From ba5c0002ab9f01ac8c0ced3b4d8d7ee4f10ce665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Thu, 21 May 2026 21:42:09 -0300 Subject: [PATCH] fix(compat): add vimwiki#vars shim for vimwiki-sync and vim-zettel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Third-party plugins such as vimwiki-sync and vim-zettel call vimwiki#vars#get_wikilocal() — a function only provided by the original vimwiki plugin. Without it, the after/ftplugin loaded by vimwiki-sync errors on every wiki buffer open: E117: Unknown function: vimwiki#vars#get_wikilocal E121: Undefined variable: g:zettel_dir Add autoload/vimwiki/vars.vim with lightweight stubs for the two keys vimwiki-sync uses ('path', 'is_temporary_wiki'), reading values from nuwiki's own g:nuwiki_wiki_root / g:nuwiki_file_extension config so users don't have to duplicate settings. get_global() is stubbed as a no-op for completeness. Co-Authored-By: Claude Sonnet 4.6 --- autoload/vimwiki/vars.vim | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 autoload/vimwiki/vars.vim diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim new file mode 100644 index 0000000..8ed1bc3 --- /dev/null +++ b/autoload/vimwiki/vars.vim @@ -0,0 +1,39 @@ +" 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') +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