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:
@@ -728,6 +728,23 @@ endtry
|
||||
call s:record(s:nm_err ==# '' ? 1 : 0,
|
||||
\ 'cmd.VimwikiSearch_no_match_graceful', 'err=' . s:nm_err)
|
||||
|
||||
" ===== auto_header inserts `= Stem =` on a new wiki page; skips the index =====
|
||||
let s:ah_root = fnamemodify(expand(nuwiki#commands#wiki_list()[0].root), ':p')
|
||||
if s:ah_root[len(s:ah_root)-1:] !=# '/' | let s:ah_root .= '/' | endif
|
||||
new
|
||||
execute 'file ' . fnameescape('/tmp/nuwiki-ah-plain/MyNewPage.wiki')
|
||||
call nuwiki#commands#auto_header()
|
||||
call s:record(getline(1) ==# '= MyNewPage =' ? 1 : 0,
|
||||
\ 'cmd.auto_header_inserts', 'line1=' . getline(1))
|
||||
bwipeout!
|
||||
new
|
||||
execute 'file ' . fnameescape(s:ah_root . 'index.wiki')
|
||||
call nuwiki#commands#auto_header()
|
||||
call s:record(getline(1) ==# '' ? 1 : 0,
|
||||
\ 'cmd.auto_header_skips_index', 'line1=' . getline(1))
|
||||
bwipeout!
|
||||
unlet s:ah_root
|
||||
|
||||
" ===== :VimwikiGoto -nargs=* =====
|
||||
" Was -nargs=1, so a page name with a space raised E488 (and the empty-arg
|
||||
" prompt fallback was unreachable). Now -nargs=*: a multi-word arg must parse.
|
||||
|
||||
Reference in New Issue
Block a user