g:vimwiki_listsyms is a string again, not a list

this is to be backwards compatible
we still need to split it into a list internally, because indexing
doesn't work for unicode symbols
This commit is contained in:
EinfachToll 2014-01-06 13:49:29 +01:00
parent 96dfabb03b
commit 9810ff1c55
7 changed files with 23 additions and 21 deletions

View File

@ -694,7 +694,7 @@ function! s:get_rate(item) "{{{
return -1 return -1
endif endif
let state = a:item.cb let state = a:item.cb
return index(g:vimwiki_listsyms, state) * 25 return index(g:vimwiki_listsyms_list, state) * 25
endfunction "}}} endfunction "}}}
"Set state of the list item to [ ] or [o] or whatever "Set state of the list item to [ ] or [o] or whatever
@ -731,15 +731,15 @@ endfunction "}}}
function! s:rate_to_state(rate) "{{{ function! s:rate_to_state(rate) "{{{
let state = '' let state = ''
if a:rate == 100 if a:rate == 100
let state = g:vimwiki_listsyms[4] let state = g:vimwiki_listsyms_list[4]
elseif a:rate == 0 elseif a:rate == 0
let state = g:vimwiki_listsyms[0] let state = g:vimwiki_listsyms_list[0]
elseif a:rate >= 67 elseif a:rate >= 67
let state = g:vimwiki_listsyms[3] let state = g:vimwiki_listsyms_list[3]
elseif a:rate >= 34 elseif a:rate >= 34
let state = g:vimwiki_listsyms[2] let state = g:vimwiki_listsyms_list[2]
else else
let state = g:vimwiki_listsyms[1] let state = g:vimwiki_listsyms_list[1]
endif endif
return state return state
endfunction "}}} endfunction "}}}
@ -793,7 +793,7 @@ function! s:create_cb(item) "{{{
endif endif
let new_item = a:item let new_item = a:item
let new_item.cb = g:vimwiki_listsyms[0] let new_item.cb = g:vimwiki_listsyms_list[0]
call s:substitute_rx_in_line(new_item.lnum, call s:substitute_rx_in_line(new_item.lnum,
\ vimwiki#u#escape(new_item.mrkr) . '\zs\ze', ' [' . new_item.cb . ']') \ vimwiki#u#escape(new_item.mrkr) . '\zs\ze', ' [' . new_item.cb . ']')
@ -1493,6 +1493,8 @@ function! vimwiki#lst#setup_marker_infos() "{{{
let g:vimwiki_rxListNumber = '$^' let g:vimwiki_rxListNumber = '$^'
endif endif
"the user can set the listsyms as string, but vimwiki needs a list
let g:vimwiki_listsyms_list = split(g:vimwiki_listsyms, '\zs')
endfunction "}}} endfunction "}}}
function! vimwiki#lst#TO_list_item(inner, visual) "{{{ function! vimwiki#lst#TO_list_item(inner, visual) "{{{

View File

@ -1879,15 +1879,15 @@ Default: 'Vimwiki'
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:vimwiki_listsyms* *g:vimwiki_listsyms*
List of 5 symbols for list items with checkboxes. String of 5 symbols for list items with checkboxes.
Default value is [' ', '.', 'o', 'O', 'X']. Default value is ' .oOX'.
g:vimwiki_listsyms[0] is for 0% done items. The first char is for 0% done items.
g:vimwiki_listsyms[4] is for 100% done items. The fifth is for 100% done items.
You can set it to some more fancy symbols like this: You can set it to some more fancy symbols like this:
>
let g:vimwiki_listsyms = ['✗', '', '', '', '✓'] let g:vimwiki_listsyms = '✗○◐●✓'
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:vimwiki_use_mouse* *g:vimwiki_use_mouse*

View File

@ -392,7 +392,7 @@ call s:default('ext2syntax', {}) " syntax map keyed on extension
call s:default('hl_headers', 0) call s:default('hl_headers', 0)
call s:default('hl_cb_checked', 0) call s:default('hl_cb_checked', 0)
call s:default('list_ignore_newline', 1) call s:default('list_ignore_newline', 1)
call s:default('listsyms', [' ', '.', 'o', 'O', 'X']) call s:default('listsyms', ' .oOX')
call s:default('use_calendar', 1) call s:default('use_calendar', 1)
call s:default('table_mappings', 1) call s:default('table_mappings', 1)
call s:default('table_auto_fmt', 1) call s:default('table_auto_fmt', 1)

View File

@ -404,7 +404,7 @@ execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/'
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListItem.'/' execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListItem.'/'
if g:vimwiki_hl_cb_checked == 1 if g:vimwiki_hl_cb_checked == 1
execute 'syntax match VimwikiCheckBoxDone /'.g:vimwiki_rxListItemWithoutCB.'\s*\['.g:vimwiki_listsyms[4].'\]\s.*$/ '. execute 'syntax match VimwikiCheckBoxDone /'.g:vimwiki_rxListItemWithoutCB.'\s*\['.g:vimwiki_listsyms_list[4].'\]\s.*$/ '.
\ 'contains=VimwikiNoExistsLink,VimwikiLink,@Spell' \ 'contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
elseif g:vimwiki_hl_cb_checked == 2 elseif g:vimwiki_hl_cb_checked == 2
execute 'syntax match VimwikiCheckBoxDone /'.g:vimwiki_rxListItemAndChildren.'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell' execute 'syntax match VimwikiCheckBoxDone /'.g:vimwiki_rxListItemAndChildren.'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'

View File

@ -83,8 +83,8 @@ let g:vimwiki_rxListDefine = '::\(\s\|$\)'
call vimwiki#lst#setup_marker_infos() call vimwiki#lst#setup_marker_infos()
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s' let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.join(g:vimwiki_listsyms, '').']\)\]\s\)\?' let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.g:vimwiki_listsyms.']\)\]\s\)\?'
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*' let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms_list[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
" Preformatted text " Preformatted text
let g:vimwiki_rxPreStart = '{{{' let g:vimwiki_rxPreStart = '{{{'

View File

@ -80,8 +80,8 @@ let g:vimwiki_rxListDefine = '::\%(\s\|$\)'
call vimwiki#lst#setup_marker_infos() call vimwiki#lst#setup_marker_infos()
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s' let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.join(g:vimwiki_listsyms, '').']\)\]\s\)\?' let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.g:vimwiki_listsyms.']\)\]\s\)\?'
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*' let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms_list[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
" Preformatted text " Preformatted text
let g:vimwiki_rxPreStart = '```' let g:vimwiki_rxPreStart = '```'

View File

@ -61,8 +61,8 @@ let g:vimwiki_rxListDefine = '^\%(;\|:\)\s'
call vimwiki#lst#setup_marker_infos() call vimwiki#lst#setup_marker_infos()
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s' let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.join(g:vimwiki_listsyms, '').']\)\]\s\)\?' let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.g:vimwiki_listsyms.']\)\]\s\)\?'
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*' let g:vimwiki_rxListItemAndChildren = '^\('.g:vimwiki_rxListBullet.'\)\s\+\['.g:vimwiki_listsyms_list[4].'\]\s.*\%(\n\%(\1\%('.g:vimwiki_rxListBullet.'\).*\|^$\|\s.*\)\)*'
" Preformatted text " Preformatted text
let g:vimwiki_rxPreStart = '<pre>' let g:vimwiki_rxPreStart = '<pre>'