Cherry-pick the changes from dev -- part 1
This commit is contained in:
parent
5419fad3f7
commit
19f398c73e
@ -860,7 +860,11 @@ function! s:process_tag_list(line, lists) "{{{
|
||||
let chk = matchlist(a:line, a:rx_list)
|
||||
if !empty(chk) && len(chk[1]) > 0
|
||||
let completion = index(vimwiki#vars#get_syntaxlocal('listsyms_list'), chk[1])
|
||||
if completion >= 0 && completion <=4
|
||||
let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
|
||||
if completion == 0
|
||||
let st_tag = '<li class="done0">'
|
||||
elseif completion > 0 && completion < n
|
||||
let completion = float2nr(round(completion / (n-1.0) * 3.0 + 0.5 ))
|
||||
let st_tag = '<li class="done'.completion.'">'
|
||||
endif
|
||||
endif
|
||||
@ -979,7 +983,11 @@ function! s:process_tag_para(line, para) "{{{
|
||||
let para = 1
|
||||
endif
|
||||
let processed = 1
|
||||
call add(lines, a:line)
|
||||
if vimwiki#vars#get_global('text_ignore_newline')
|
||||
call add(lines, a:line)
|
||||
else
|
||||
call add(lines, a:line."<br />")
|
||||
endif
|
||||
elseif para && a:line =~# '^\s*$'
|
||||
call add(lines, "</p>")
|
||||
let para = 0
|
||||
|
@ -697,7 +697,8 @@ function! s:get_rate(item) "{{{
|
||||
return -1
|
||||
endif
|
||||
let state = a:item.cb
|
||||
return index(vimwiki#vars#get_syntaxlocal('listsyms_list'), state) * 25
|
||||
let n = len(vimwiki#vars#get_syntaxlocal('listsyms_list'))
|
||||
return index(vimwiki#vars#get_syntaxlocal('listsyms_list'), state) * 100/(n-1)
|
||||
endfunction "}}}
|
||||
|
||||
"Set state of the list item to [ ] or [o] or whatever
|
||||
@ -732,17 +733,16 @@ endfunction "}}}
|
||||
|
||||
"Returns: the appropriate symbol for a given percent rate
|
||||
function! s:rate_to_state(rate) "{{{
|
||||
let listsyms_list = vimwiki#vars#get_syntaxlocal('listsyms_list')
|
||||
let state = ''
|
||||
let n = len(listsyms_list)
|
||||
if a:rate == 100
|
||||
let state = vimwiki#vars#get_syntaxlocal('listsyms_list')[4]
|
||||
let state = listsyms_list[n-1]
|
||||
elseif a:rate == 0
|
||||
let state = vimwiki#vars#get_syntaxlocal('listsyms_list')[0]
|
||||
elseif a:rate >= 67
|
||||
let state = vimwiki#vars#get_syntaxlocal('listsyms_list')[3]
|
||||
elseif a:rate >= 34
|
||||
let state = vimwiki#vars#get_syntaxlocal('listsyms_list')[2]
|
||||
let state = listsyms_list[0]
|
||||
else
|
||||
let state = vimwiki#vars#get_syntaxlocal('listsyms_list')[1]
|
||||
let index = float2nr(ceil(a:rate/100.0*(n-2)))
|
||||
let state = listsyms_list[index]
|
||||
endif
|
||||
return state
|
||||
endfunction "}}}
|
||||
|
@ -47,6 +47,7 @@ function! s:populate_global_variables()
|
||||
\ 'html_header_numbering': 0,
|
||||
\ 'html_header_numbering_sym': '',
|
||||
\ 'list_ignore_newline': 1,
|
||||
\ 'text_ignore_newline': 1,
|
||||
\ 'listsyms': ' .oOX',
|
||||
\ 'map_prefix': '<Leader>w',
|
||||
\ 'menu': 'Vimwiki',
|
||||
@ -384,13 +385,13 @@ function! vimwiki#vars#populate_syntax_vars(syntax)
|
||||
if g:vimwiki_syntax_variables[a:syntax].recurring_bullets
|
||||
let g:vimwiki_syntax_variables[a:syntax].rxListItemAndChildren =
|
||||
\ '^\('.g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\)\s\+\['
|
||||
\ . g:vimwiki_syntax_variables[a:syntax].listsyms_list[4].'\]\s.*\%(\n\%(\1\%('
|
||||
\ . g:vimwiki_syntax_variables[a:syntax].listsyms_list[-1].'\]\s.*\%(\n\%(\1\%('
|
||||
\ .g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\).*\|^$\|\s.*\)\)*'
|
||||
else
|
||||
let g:vimwiki_syntax_variables[a:syntax].rxListItemAndChildren =
|
||||
\ '^\(\s*\)\%('.g:vimwiki_syntax_variables[a:syntax].rxListBullet.'\|'
|
||||
\ . g:vimwiki_syntax_variables[a:syntax].rxListNumber.'\)\s\+\['
|
||||
\ . g:vimwiki_syntax_variables[a:syntax].listsyms_list[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
|
||||
\ . g:vimwiki_syntax_variables[a:syntax].listsyms_list[-1].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
|
||||
endif
|
||||
|
||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
||||
|
@ -1277,40 +1277,50 @@ Tags-related commands and options:
|
||||
6. Folding/Outline *vimwiki-folding*
|
||||
|
||||
Vimwiki can fold or outline sections using headers and preformatted blocks.
|
||||
Alternatively, one can fold list subitems instead.
|
||||
Alternatively, one can fold list subitems instead. Folding is not enabled
|
||||
by default, and requires the |g:vimwiki_folding| variable to be set.
|
||||
|
||||
Example for list folding with |g:vimwiki_folding| set to 'list':
|
||||
|
||||
Example for list folding:
|
||||
= My current task =
|
||||
* [ ] Do stuff 1
|
||||
* [ ] Do substuff 1.1
|
||||
* [ ] Do substuff 1.2
|
||||
* [ ] Do substuff 1.2.1
|
||||
* [ ] Do substuff 1.2.2
|
||||
* [ ] Do substuff 1.3
|
||||
* [ ] Do stuff 2
|
||||
* [ ] Do stuff 3
|
||||
* [ ] Do stuff 1
|
||||
* [ ] Do substuff 1.1
|
||||
* [ ] Do substuff 1.2
|
||||
* [ ] Do substuff 1.2.1
|
||||
* [ ] Do substuff 1.2.2
|
||||
* [ ] Do substuff 1.3
|
||||
* [ ] Do stuff 2
|
||||
* [ ] Do stuff 3
|
||||
|
||||
Hit |zM| :
|
||||
= My current task = [8] --------------------------------------~
|
||||
= My current task =
|
||||
* [ ] Do stuff 1 [6] --------------------------------------~
|
||||
* [ ] Do stuff 2
|
||||
* [ ] Do stuff 3
|
||||
|
||||
Hit |zr| :
|
||||
= My current task =~
|
||||
* [ ] Do stuff 1 [5] --------------------------------------~
|
||||
* [ ] Do stuff 2~
|
||||
* [ ] Do stuff 3~
|
||||
= My current task =
|
||||
* [ ] Do stuff 1
|
||||
* [ ] Do substuff 1.1
|
||||
* [ ] Do substuff 1.2 [3] -------------------------------~
|
||||
* [ ] Do substuff 1.3
|
||||
* [ ] Do stuff 2
|
||||
* [ ] Do stuff 3
|
||||
|
||||
Hit |zr| one more time:
|
||||
= My current task =~
|
||||
* [ ] Do stuff 1~
|
||||
* [ ] Do substuff 1.1~
|
||||
* [ ] Do substuff 1.2 [2] -------------------------------~
|
||||
* [ ] Do substuff 1.3~
|
||||
* [ ] Do stuff 2~
|
||||
* [ ] Do stuff 3~
|
||||
Hit |zr| one more time :
|
||||
= My current task =
|
||||
* [ ] Do stuff 1
|
||||
* [ ] Do substuff 1.1
|
||||
* [ ] Do substuff 1.2
|
||||
* [ ] Do substuff 1.2.1
|
||||
* [ ] Do substuff 1.2.2
|
||||
* [ ] Do substuff 1.3
|
||||
* [ ] Do stuff 2
|
||||
* [ ] Do stuff 3
|
||||
|
||||
Note: If you use the default Vimwiki syntax, folding on list items will work
|
||||
properly only if all of them are indented using the current 'shiftwidth'.
|
||||
For MediaWiki, * or # should be in the first column.
|
||||
For MediaWiki syntax, * or # should be in the first column.
|
||||
|
||||
To turn folding on/off check |g:vimwiki_folding|.
|
||||
|
||||
@ -2241,11 +2251,11 @@ Default: 'Vimwiki'
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_listsyms*
|
||||
|
||||
String of 5 symbols to show the progression of todo list items.
|
||||
String of at least two symbols to show the progression of todo list items.
|
||||
Default value is ' .oOX'.
|
||||
|
||||
The first char is for 0% done items.
|
||||
The fifth is for 100% done items.
|
||||
The last is for 100% done items.
|
||||
|
||||
You can set it to some more fancy symbols like this:
|
||||
>
|
||||
@ -2298,6 +2308,19 @@ Value Description~
|
||||
Default: 1
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_text_ignore_newline*
|
||||
|
||||
This is HTML related.
|
||||
Convert newlines to <br />s in text.
|
||||
|
||||
Value Description~
|
||||
0 Newlines in text are converted to <br />s.
|
||||
1 Ignore newlines.
|
||||
|
||||
Default: 1
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:vimwiki_use_calendar*
|
||||
|
||||
|
@ -235,9 +235,9 @@ execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine'
|
||||
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_syntaxlocal('rxListItem').'/'
|
||||
|
||||
if vimwiki#vars#get_global('hl_cb_checked') == 1
|
||||
execute 'syntax match VimwikiCheckBoxDone '
|
||||
\ . ' /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB').'\s*\['.vimwiki#vars#get_syntaxlocal('listsyms_list')[4].'\]\s.*$/'
|
||||
\ . ' contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB')
|
||||
\ .'\s*\['.vimwiki#vars#get_syntaxlocal('listsyms_list')[-1]
|
||||
\ .'\]\s.*$/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_syntaxlocal('rxListItemAndChildren').'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user