Merge remote-tracking branch 'origin/calendar-support' into feature-gap
# Conflicts: # development/vimwiki-gap.md
This commit is contained in:
@@ -33,6 +33,30 @@ else
|
||||
command! -nargs=0 NuwikiInstall execute 'source' fnameescape(s:plugin_root . '/scripts/download_bin.vim')
|
||||
endif
|
||||
|
||||
" Calendar-Vim Integration — auto-detect when calendar-vim is loaded.
|
||||
augroup nuwiki_calendar_detect
|
||||
autocmd!
|
||||
autocmd FileType vimwiki call s:nuwiki_setup_calendar()
|
||||
augroup END
|
||||
function! s:nuwiki_setup_calendar() abort
|
||||
if !get(g:, 'nuwiki_use_calendar', 1) || get(g:, 'nuwiki_no_calendar', 0)
|
||||
return
|
||||
endif
|
||||
if exists('*calendar#open') || exists(':Calendar') == 2
|
||||
" Wire nuwiki's diary hooks unless the user set a custom (non-default) one.
|
||||
" calendar-vim's own default is 'calendar#diary' (writes to ~/diary); we
|
||||
" overwrite that so paths come from the wiki root config instead.
|
||||
let l:act = get(g:, 'calendar_action', '')
|
||||
if l:act ==# '' || l:act ==# 'calendar#diary'
|
||||
let g:calendar_action = 'vimwiki#diary#calendar_action'
|
||||
endif
|
||||
let l:sign = get(g:, 'calendar_sign', '')
|
||||
if l:sign ==# '' || l:sign ==# 'calendar#sign'
|
||||
let g:calendar_sign = 'vimwiki#diary#calendar_sign'
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if has('nvim')
|
||||
" Neovim path is initialised by `require('nuwiki').setup()`. Nothing else
|
||||
" to do at vimscript boot — wait until the user runs setup.
|
||||
|
||||
Reference in New Issue
Block a user