vimwiki

Personal wiki for vim
git clone https://github.com/vimwiki/vimwiki.git
Log | Files | Refs | README | LICENSE

commit c58d5da0499c61ce0f707e3fa7577bb4f981fc17
parent fb5d2f3f8274d3ecd536d03a72b1f66ec0827b56
Author: Rane Brown <rane.brown@gmail.com>
Date:   Mon,  2 Dec 2019 12:53:41 -0700

Set default ext2syntax values for markdown and mediawiki.

Closes #769.

Also fixes an error when adding missing '.' to mapped extensions. The
previous behavior tried to access a value after it was removed from the
dictionary.

Diffstat:
Mautoload/vimwiki/vars.vim | 14+++++++++-----
Mdoc/vimwiki.txt | 19++++++++++++-------
2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim @@ -157,7 +157,8 @@ function! s:read_global_settings_from_user() \ 10: 'October', 11: 'November', 12: 'December' \ }}, \ 'dir_link': {'type': type(''), 'default': ''}, - \ 'ext2syntax': {'type': type({}), 'default': {}}, + \ 'ext2syntax': {'type': type({}), 'default': {'.md': 'markdown', '.mkdn': 'markdown', + \ '.mdwn': 'markdown', '.mdown': 'markdown', '.markdown': 'markdown', '.mw': 'media'}}, \ 'folding': {'type': type(''), 'default': '', 'possible_values': ['', 'expr', 'syntax', \ 'list', 'custom', ':quick', 'expr:quick', 'syntax:quick', 'list:quick', \ 'custom:quick']}, @@ -245,16 +246,19 @@ endfunction function! s:normalize_global_settings() let keys = keys(g:vimwiki_global_vars.ext2syntax) for ext in keys + " for convenience, we also allow the term 'mediawiki' + if g:vimwiki_global_vars.ext2syntax[ext] ==# 'mediawiki' + let g:vimwiki_global_vars.ext2syntax[ext] = 'media' + endif + " ensure the file extensions in ext2syntax start with a dot + " make sure this occurs after anything else that tries to access + " the entry using the index 'ext' since this removes that index if ext[0] != '.' let new_ext = '.' . ext let g:vimwiki_global_vars.ext2syntax[new_ext] = g:vimwiki_global_vars.ext2syntax[ext] call remove(g:vimwiki_global_vars.ext2syntax, ext) endif - " for convenience, we also allow the term 'mediawiki' - if g:vimwiki_global_vars.ext2syntax[ext] ==# 'mediawiki' - let g:vimwiki_global_vars.ext2syntax[ext] = 'media' - endif endfor " ensure key_mappings dictionary has all required keys diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt @@ -2657,13 +2657,18 @@ E.g.: > \ '.mkd': 'markdown', \ '.wiki': 'media'} -An extension that is registered with Vimwiki can trigger creation of a -|vimwiki-temporary-wiki| with the associated syntax. File extensions used in -|g:vimwiki_list| are automatically registered with Vimwiki using the default -syntax. - -Default: {} - +An extension that is registered with Vimwiki can trigger creation of +a |vimwiki-temporary-wiki|. File extensions used in |g:vimwiki_list| are +automatically registered with Vimwiki using the default syntax. Extensions +mapped with this option will instead use the mapped syntax. + +Default: > + {'.md': 'markdown', '.mkdn': 'markdown', + \ '.mdwn': 'markdown', '.mdown': 'markdown', + \ '.markdown': 'markdown', '.mw': 'media'}}, + +Note: setting this option will overwrite the default values so include them if +desired. ------------------------------------------------------------------------------ *g:vimwiki_menu*