feat(keymaps): configurable map_prefix for the wiki command family (P2)
Mirror vimwiki's g:vimwiki_map_prefix. The whole <Leader>w* family was
hardcoded across the map layer; it is now built from a configurable prefix:
- Neovim: `map_prefix` setup() option (default '<Leader>w'), read by
lua/nuwiki/keymaps.lua (buffer-local) and lua/nuwiki/init.lua (global
entry points).
- Vim: g:nuwiki_map_prefix, applied via :exe in plugin/nuwiki.vim (global)
and ftplugin/vimwiki.vim (buffer-local).
Setting a custom prefix relocates <prefix>{w,t,s,i,n,d,r,c,h,hh,ha} and
<prefix><Leader>{w,y,t,m,i}, leaving nothing under the old <Leader>w*.
Non-prefix maps (<CR>, gl*, headers, …) are untouched.
Tests: new test-keymaps-vim-prefix.vim harness (21 cases, wired into
test-keymaps-vim.sh) + map_prefix.relocates_wiki_family in test-keymaps.lua.
Docs: README, doc/nuwiki.txt, lua config comment, vimwiki-gap.md ticked.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -281,6 +281,7 @@ let g:nuwiki_file_extension = '.wiki'
|
||||
let g:nuwiki_log_level = 'warn'
|
||||
let g:nuwiki_link_severity = 'warn' " 'off'|'hint'|'warn'|'error'
|
||||
let g:nuwiki_no_default_mappings = 0 " set to 1 to skip the keymap layer
|
||||
let g:nuwiki_map_prefix = '<Leader>w' " wiki command prefix
|
||||
let g:nuwiki_no_folding = 0 " set to 1 to skip foldexpr setup
|
||||
let g:nuwiki_mouse_mappings = 0 " set to 1 to enable mouse maps
|
||||
" Drop individual keymap subgroups (mirror the Lua `mappings.<group>` toggles):
|
||||
@@ -297,6 +298,7 @@ let g:nuwiki_mouse_mappings = 0 " set to 1 to enable mouse maps
|
||||
| `file_extension` | string | `'.wiki'` | any extension, leading `.` |
|
||||
| `syntax` | string | `'vimwiki'` | `'vimwiki'` (`'markdown'` planned) |
|
||||
| `log_level` | string | `'warn'` | `'error'` \| `'warn'` \| `'info'` \| `'debug'` |
|
||||
| `map_prefix` | string | `'<Leader>w'` | prefix for the wiki command family (`<prefix>w`, `<prefix>t`, `<prefix><Leader>w`, …); mirrors vimwiki's `g:vimwiki_map_prefix`. Vim users set `g:nuwiki_map_prefix` |
|
||||
| `folding` | string | `'lsp'` | `'lsp'` \| `'expr'` \| `'off'` |
|
||||
| `wikis` | list of tables | `nil` | per-wiki tables (see below); wins over the single-wiki shorthand |
|
||||
| `mappings` | table | all on | keymap subgroups (see below) |
|
||||
|
||||
Reference in New Issue
Block a user