feat(calendar): integrate calendar-vim with wiki diary paths
CI / cargo fmt --check (push) Successful in 34s
CI / cargo clippy (push) Successful in 43s
CI / cargo test (push) Successful in 41s
CI / editor keymaps (push) Successful in 1m29s

Wire g:calendar_action/g:calendar_sign to nuwiki diary hooks that
resolve diary paths from the wiki root config instead of calendar-vim's
default ~/diary. Auto-detected on FileType vimwiki when calendar-vim is
present; opt out with g:nuwiki_use_calendar=0 or g:nuwiki_no_calendar.

- autoload/nuwiki/diary.vim: calendar_action/calendar_sign using wiki cfg;
  open diary in the previous window and close the calendar window after.
- autoload/vimwiki/diary.vim: vimwiki# aliases for drop-in compatibility.
- plugin/nuwiki.vim + lua/nuwiki/init.lua: auto-wire hooks, overwriting
  calendar-vim's defaults while respecting user-set custom hooks.
- lua/nuwiki/config.lua: add use_calendar option (on by default).
- development/start-*.sh + _common.sh: clone calendar-vim, fix vimrc var
  expansion, pass wiki root to the Vim/Neovim clients.
This commit is contained in:
2026-05-31 21:34:41 -03:00
parent 39692ba99f
commit 7a3e11cfeb
9 changed files with 211 additions and 36 deletions
+15 -15
View File
@@ -114,25 +114,27 @@ write_vimrc() {
" Confine state to the dev cache so we never touch the user's real Vim
" install.
set viminfo='100,n$VIM_STATE/viminfo
let &directory = '$VIM_STATE/swap//'
let &backupdir = '$VIM_STATE/backup//'
let &undodir = '$VIM_STATE/undo//'
set viminfo='100,n${VIM_STATE}/viminfo
let &directory = '${VIM_STATE}/swap//'
let &backupdir = '${VIM_STATE}/backup//'
let &undodir = '${VIM_STATE}/undo//'
" Make Vim look for runtime paths in the dev cache. vim-lsp is intentionally
" absent so nuwiki dispatches jump-to-definition through coc.
set nocompatible
let &runtimepath = '$REPO_ROOT' . ',' . &runtimepath
let &runtimepath .= ',$COC_DIR'
let &runtimepath = '${REPO_ROOT}' . ',' . &runtimepath
let &runtimepath .= ',${COC_DIR}'
let &runtimepath .= ',${DEV_DIR}/calendar-vim'
" Point coc at the generated settings + a private data dir.
let g:coc_config_home = '$DEV_DIR'
let g:coc_data_home = '$COC_DATA'
let g:coc_config_home = '${DEV_DIR}'
let g:coc_data_home = '${COC_DATA}'
let g:nuwiki_binary_path = '$REPO_ROOT/bin/nuwiki-ls'
let g:nuwiki_wiki_root = '$WIKI_DIR'
let g:nuwiki_binary_path = '${REPO_ROOT}/bin/nuwiki-ls'
let g:nuwiki_wiki_root = '${WIKI_DIR}'
let g:nuwiki_file_extension = '.wiki'
let g:nuwiki_syntax = 'vimwiki'
let g:nuwiki_diary_rel_path = 'diary'
let g:nuwiki_log_level = 'info'
filetype plugin indent on
@@ -153,11 +155,8 @@ augroup NuwikiFtdetect
autocmd BufRead,BufNewFile *.wiki setfiletype vimwiki
augroup END
" coc starts the server automatically from coc-settings.json once a vimwiki
" buffer loads — no explicit nuwiki#lsp#start() needed.
echomsg '[nuwiki-dev] ready (coc.nvim) — wiki root: $WIKI_DIR'
echomsg '[nuwiki-dev] coc.preferences.jumpCommand = $COC_JUMP'
echo
echomsg '[nuwiki-dev] coc.preferences.jumpCommand = ' . '\$COC_JUMP'
echomsg '[nuwiki-dev] <CR> on a [[link]] should open in the CURRENT window'
echomsg '[nuwiki-dev] :CocList services for status, :messages for log'
EOF
@@ -167,6 +166,7 @@ main() {
ensure_node
ensure_binary
ensure_coc
ensure_calendar_vim
write_coc_settings
seed_wiki
write_vimrc