Allow to specify additional chars for lists

This commit is contained in:
Michael F. Schönitzer 2017-09-16 16:30:22 +02:00
parent 976cbbcd23
commit 41e653718e
3 changed files with 18 additions and 6 deletions

View File

@ -1455,7 +1455,11 @@ function! s:convert_file(path_html, wikifile) "{{{
endif endif
" prepare regexps for lists " prepare regexps for lists
let s:bullets = '[*-]' if exists("g:vimwiki_additional_bullet_types")
let s:bullets = '[*-'. join(keys(g:vimwiki_additional_bullet_types), '') . ']'
else
let s:bullets = '[*-]'
endif
let s:numbers = let s:numbers =
\'\C\%(#\|\d\+)\|\d\+\.\|[ivxlcdm]\+)\|[IVXLCDM]\+)\|\l\{1,2})\|\u\{1,2})\)' \'\C\%(#\|\d\+)\|\d\+\.\|[ivxlcdm]\+)\|[IVXLCDM]\+)\|\l\{1,2})\|\u\{1,2})\)'

View File

@ -1509,11 +1509,15 @@ endfunction "}}}
"misc stuff {{{ "misc stuff {{{
function! vimwiki#lst#setup_marker_infos() "{{{ function! vimwiki#lst#setup_marker_infos() "{{{
let s:rx_bullet_chars = '['.join(keys(g:vimwiki_bullet_types), '').']\+' let l:bullet_types=g:vimwiki_bullet_types
if exists("g:vimwiki_additional_bullet_types")
call extend(l:bullet_types, g:vimwiki_additional_bullet_types)
endif
let s:rx_bullet_chars = '['.join(keys(l:bullet_types), '').']\+'
let s:multiple_bullet_chars = [] let s:multiple_bullet_chars = []
for i in keys(g:vimwiki_bullet_types) for i in keys(l:bullet_types)
if g:vimwiki_bullet_types[i] == 1 if l:bullet_types[i] == 1
call add(s:multiple_bullet_chars, i) call add(s:multiple_bullet_chars, i)
endif endif
endfor endfor
@ -1529,8 +1533,8 @@ function! vimwiki#lst#setup_marker_infos() "{{{
\ 'a': '\l\{1,2}', 'A': '\u\{1,2}'} \ 'a': '\l\{1,2}', 'A': '\u\{1,2}'}
"create regexp for bulleted list items "create regexp for bulleted list items
let g:vimwiki_rxListBullet = join( map(keys(g:vimwiki_bullet_types), let g:vimwiki_rxListBullet = join( map(keys(l:bullet_types),
\'vimwiki#u#escape(v:val).repeat("\\+", g:vimwiki_bullet_types[v:val])' \'vimwiki#u#escape(v:val).repeat("\\+", l:bullet_types[v:val])'
\ ) , '\|') \ ) , '\|')
"create regex for numbered list items "create regex for numbered list items

View File

@ -1552,6 +1552,10 @@ after a list using letters or vice versa, Vimwiki will get confused because
it cannot distinguish which is which (at least if the types are both upper it cannot distinguish which is which (at least if the types are both upper
case or both lower case). case or both lower case).
You can add additional list-types in your vimrc by setting the variable
let g:vimwiki_additional_bullet_types = { "→": 0}
Corresponding mapings will not be set.
See |vimwiki_glstar|, |vimwiki_gl#| |vimwiki_gl-|, |vimwiki_gl-|, See |vimwiki_glstar|, |vimwiki_gl#| |vimwiki_gl-|, |vimwiki_gl-|,
|vimwiki_gl1|, |vimwiki_gla|, |vimwiki_glA|, |vimwiki_gli|, |vimwiki_glI| |vimwiki_gl1|, |vimwiki_gla|, |vimwiki_glA|, |vimwiki_gli|, |vimwiki_glI|