feat(calendar): diary into the current wiki, not always the first
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user