test(calendar): add Vim + Neovim integration harnesses
CI / cargo fmt --check (push) Successful in 26s
CI / cargo clippy (push) Successful in 27s
CI / cargo test (push) Successful in 31s
CI / editor keymaps (push) Successful in 1m30s

Add headless harnesses covering the calendar-vim integration, wired into
CI alongside the existing keymap/config suites:

- test-calendar-vim.sh/.vim (+ -optout.vim): pure-VimL diary hooks
  (calendar_sign markers, calendar_action path resolution from wiki root,
  calendar window close), plugin/nuwiki.vim hook auto-wiring that
  overrides calendar-vim's defaults, and opt-out via g:nuwiki_use_calendar
  and g:nuwiki_no_calendar. Uses a stub calendar-vim on the runtimepath.
- test-calendar.sh/.lua: Neovim setup() wiring + window-close under the
  real window API, and opt-out via use_calendar = false.

Fixes surfaced by the suite:
- diary.vim: new diary entries set filetype 'vimwiki' (was the raw
  extension, e.g. 'wiki'); the stray FileType autocmd also blocked the
  calendar window from closing.
- init.lua: drop the redundant Neovim FileType autocmd (plugin/nuwiki.vim
  already wires both editors) and translate use_calendar=false into
  g:nuwiki_no_calendar so the opt-out actually disables wiring.
This commit is contained in:
2026-05-31 21:45:50 -03:00
parent 7a3e11cfeb
commit 87ba4c1764
9 changed files with 475 additions and 27 deletions
+4 -6
View File
@@ -34,12 +34,10 @@ function! nuwiki#diary#calendar_action(day, month, year, week, dir) abort
endif
execute 'edit ' . fnameescape(l:file_path)
if !filereadable(l:file_path)
if l:c.ext[0] ==# '.'
execute 'setfiletype ' . l:c.ext[1:]
else
execute 'setfiletype ' . l:c.ext
endif
" A brand-new entry has no file on disk yet, so ftdetect may not have run;
" ensure the vimwiki filetype so syntax/maps are active immediately.
if &filetype !=# 'vimwiki'
setfiletype vimwiki
endif
" Close the calendar window now that the diary is open (keep at least one).