feat(config): P3 config batch — group 2 (create_link, dir_link, auto_header)
- create_link (default true): server resolve_target_uri now only synthesises a missing-page URI when create_link is set; when off, following a link to a non-existent page returns no location (no-op). - dir_link: a [[dir/]] link now resolves to <dir>/<dir_link><ext> when dir_link is set, else opens the directory itself. Uses the already-parsed LinkTarget.is_directory. - auto_header (default off): new wiki pages get a `= Stem =` header derived from the filename, skipping the wiki index + diary index. Client-side BufNewFile autocmd in both clients (init.lua + plugin/nuwiki.vim), with auto_header handlers in both command layers (trailing-slash-robust root matching). Tests: cmd.auto_header_inserts + cmd.auto_header_skips_diary_index (nvim) / cmd.auto_header_skips_index (vim). Full rust suite + both harnesses green (Neovim 307, Vim 301/18/21). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,19 @@ augroup nuwiki_vim_lsp_start
|
||||
autocmd FileType vimwiki call nuwiki#lsp#start()
|
||||
augroup END
|
||||
|
||||
" vimwiki `auto_header` (default off): insert a level-1 header from the filename
|
||||
" on new wiki pages. BufNewFile fires only for genuinely new files. Matches the
|
||||
" configured extension(s).
|
||||
if get(g:, 'nuwiki_auto_header', 0)
|
||||
let s:awh_ext = get(g:, 'nuwiki_file_extension', '.wiki')
|
||||
let s:awh_ext = s:awh_ext[0] ==# '.' ? s:awh_ext : '.' . s:awh_ext
|
||||
augroup nuwiki_auto_header
|
||||
autocmd!
|
||||
execute 'autocmd BufNewFile *' . s:awh_ext . ' call nuwiki#commands#auto_header()'
|
||||
augroup END
|
||||
unlet s:awh_ext
|
||||
endif
|
||||
|
||||
" Global wiki-picker commands — available from any buffer so a wiki can be
|
||||
" chosen before a .wiki file exists. The picker reads its list from config
|
||||
" (no LSP); opening the chosen index then auto-starts the server. The
|
||||
|
||||
Reference in New Issue
Block a user