feat(calendar): diary into the current wiki, not always the first
CI / cargo fmt --check (push) Successful in 46s
CI / cargo clippy (push) Successful in 51s
CI / cargo test (push) Successful in 58s
CI / editor keymaps (push) Successful in 1m29s

The VimL calendar-vim callbacks (nuwiki#diary#calendar_action /
calendar_sign) hardcoded wiki 0, so opening the calendar while editing
ifood_wiki still created/marked diary entries under the first wiki. (The
LSP-driven diary commands already follow the current buffer via its URI;
this brings the calendar in line.)

Track the wiki of the active buffer (nuwiki#diary#track_wiki, driven by
FileType/BufEnter autocmds in plugin/nuwiki.vim) and resolve the calendar
diary path against it, falling back to the first wiki. Verified the
calendar marker/open switch between wikis as you move between their
buffers. test-calendar-vim gains 4 multi-wiki tracking checks (16).
All keymap/config/calendar harnesses green on both clients.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-06 02:07:11 +00:00
parent 0d1a73a3ba
commit 3e8c534859
3 changed files with 54 additions and 4 deletions
+5
View File
@@ -37,6 +37,11 @@ endif
augroup nuwiki_calendar_detect
autocmd!
autocmd FileType vimwiki call s:nuwiki_setup_calendar()
" Track the wiki of the active buffer so the calendar diaries into the wiki
" you're editing (not always the first one). FileType covers initial load;
" BufEnter covers switching back to an already-open wiki buffer.
autocmd FileType vimwiki call nuwiki#diary#track_wiki(expand('%:p'))
autocmd BufEnter * if &filetype ==# 'vimwiki' | call nuwiki#diary#track_wiki(expand('%:p')) | endif
augroup END
function! s:nuwiki_setup_calendar() abort
if !get(g:, 'nuwiki_use_calendar', 1) || get(g:, 'nuwiki_no_calendar', 0)