" development/tests/test-keymaps-vim-prefix.vim — driven by " development/tests/test-keymaps-vim.sh. " " Custom-prefix regression. The shell driver sets " `g:nuwiki_map_prefix = 'n'` *before* the ftplugin loads, so this " harness asserts the whole wiki command family relocates under `n*` " while nothing remains under the default `w*`. Mirrors vimwiki's " `g:vimwiki_map_prefix` and the Lua-side `map_prefix` option. let s:results = [] let s:pass = 0 let s:fail = 0 let s:out = $NUWIKI_KEYMAP_RESULTS function! s:record(ok, name, detail) abort let l:line = (a:ok ? 'PASS' : 'FAIL') . ' ' . a:name if a:detail !=# '' let l:line .= ' — ' . a:detail endif call add(s:results, l:line) if a:ok let s:pass += 1 else let s:fail += 1 endif endfunction function! s:has_map(lhs, mode) abort let l:d = maparg(a:lhs, a:mode, 0, 1) return !empty(l:d) && get(l:d, 'buffer', 0) endfunction " Every * mapping must now live under n (prefix = n). let s:relocated = [ \ ['nw', 'n'], ['nt', 'n'], ['ns', 'n'], ['ni', 'n'], \ ['nw', 'n'], ['ny', 'n'], ['nt', 'n'], \ ['nm', 'n'], ['ni', 'n'], \ ['nn', 'n'], ['nd', 'n'], ['nr', 'n'], ['nc', 'n'], \ ['nh', 'n'], ['nhh', 'n'], ['nha', 'n'], \ ] for s:e in s:relocated let s:ok = s:has_map(s:e[0], s:e[1]) call s:record(s:ok ? 1 : 0, 'prefix.relocated.' . s:e[1] . '.' . s:e[0], \ s:ok ? '' : s:e[0] . ' not bound under custom prefix') endfor " The default w* family must be GONE (relocated, not duplicated). let s:gone = [ \ ['ww', 'n'], ['wr', 'n'], ['wh', 'n'], \ ['ww', 'n'], \ ] for s:e in s:gone let s:ok = !s:has_map(s:e[0], s:e[1]) call s:record(s:ok ? 1 : 0, 'prefix.default_gone.' . s:e[1] . '.' . s:e[0], \ s:ok ? '' : s:e[0] . ' still mapped despite custom prefix') endfor " Non-prefix maps (links group) are unaffected by the prefix change. let s:cr = s:has_map('', 'n') call s:record(s:cr ? 1 : 0, 'prefix.cr_unaffected', s:cr ? '' : ' lost') call add(s:results, '') call add(s:results, printf('SUMMARY: %d passed, %d failed', s:pass, s:fail)) call writefile(s:results, s:out) execute (s:fail == 0 ? 'qall!' : 'cquit!')