Feature: Optionally disable todo propagation to parents/children (Issue #954)
taskwiki integrates vimwiki with taskwarrior, and in doing so changes
the semantics of checkboxes a bit:
* [ ] Install Taskwiki | pending task
* [X] Install Taskwiki | completed task
* [D] Install Taskwiki | deleted task
* [S] Install Taskwiki | started task
* [W] Install Taskwiki | waiting task
It's still desirable for vimwiki to automatically insert `* [ ]` on
`i_<CR>`, `o` and `O` and to syntax highlight all these five as
checkboxes, so I have this in my .vimrc:
let g:vimwiki_listsym_rejected = 'D'
let g:vimwiki_listsyms = ' WSX'
but it results in undesirable behaviour with task hierarchies: when I
add a new subtask (using `i_<CR>`, `o` or `O`)
or mark a subtask done, the parent's checkbox is updated to reflect its
overall completion, to one of ` `, `W`, `S` or `X`, depending on
subtasks completion. This makes little sense in taskwiki. One usually
doesn't want to touch the "parent" task in taskwarrior until the
"subtasks" are done. Setting
let g:vimwiki_listsym_rejected = 'W'
let g:vimwiki_listsyms = ' SX'
results in slightly less illogical behaviour, but it still assumes that
(1) all subtasks are visible (not necessarily true in taskwiki) and
(2) that it's a parent/subtask relationship, not a dependency
relationship (not true in taskwarrior, questionable in taskwiki).
This commit adds an option to disable this behaviour.
This commit is contained in:
committed by
Tinmarino
parent
f794f1e284
commit
2a31984369
@@ -800,6 +800,10 @@ function! s:set_state_plus_children(item, new_rate, ...) abort
|
||||
call s:set_state(a:item, a:new_rate)
|
||||
endif
|
||||
|
||||
if vimwiki#vars#get_wikilocal('listsyms_propagate') == 0
|
||||
return
|
||||
endif
|
||||
|
||||
let all_children_are_done = 1
|
||||
let all_children_are_rejected = 1
|
||||
|
||||
@@ -867,7 +871,7 @@ endfunction
|
||||
"updates the symbol of a checkboxed item according to the symbols of its
|
||||
"children
|
||||
function! s:update_state(item) abort
|
||||
if a:item.type == 0 || a:item.cb ==? ''
|
||||
if a:item.type == 0 || a:item.cb ==? '' || vimwiki#vars#get_wikilocal('listsyms_propagate') == 0
|
||||
return
|
||||
endif
|
||||
|
||||
|
||||
@@ -506,6 +506,7 @@ function! s:get_default_wikilocal() abort
|
||||
\ 'list_margin': {'type': type(0), 'default': -1, 'min': -1},
|
||||
\ 'listsym_rejected': {'type': type(''), 'default': vimwiki#vars#get_global('listsym_rejected')},
|
||||
\ 'listsyms': {'type': type(''), 'default': vimwiki#vars#get_global('listsyms')},
|
||||
\ 'listsyms_propagate': {'type': type(0), 'default': 1},
|
||||
\ 'markdown_link_ext': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||
\ 'maxhi': {'type': type(0), 'default': 0, 'min': 0, 'max': 1},
|
||||
\ 'name': {'type': type(''), 'default': ''},
|
||||
|
||||
+17
-3
@@ -1880,9 +1880,10 @@ parent items: >
|
||||
* [ ] Add highlighting to list item boxes.
|
||||
* [ ] Add [ ] to the next list item created using o, O or <CR>.
|
||||
|
||||
Parent items should change when their child items change. If not, use
|
||||
|vimwiki_glr|. The symbol between [ ] depends on the percentage of toggled
|
||||
child items (see also |vimwiki-listsyms|): >
|
||||
Parent items should change when their child items change unless disabled via
|
||||
|vimwiki-option-listsyms_propagate|. If not, use |vimwiki_glr|. The symbol
|
||||
between [ ] depends on the percentage of toggled child items (see also
|
||||
|vimwiki-listsyms|): >
|
||||
[ ] -- 0%
|
||||
[.] -- 1-33%
|
||||
[o] -- 34-66%
|
||||
@@ -2674,6 +2675,16 @@ You can set it to a more fancy symbol like this:
|
||||
let g:vimwiki_list = [{'path': '~/path/', 'listsym_rejected' = '✗'}]
|
||||
|
||||
|
||||
*vimwiki-option-listsyms_propagate*
|
||||
------------------------------------------------------------------------------
|
||||
Key Default value Values~
|
||||
listsyms_propagate 1 0, 1
|
||||
|
||||
Description~
|
||||
Set this option to 0 to disable propagation of todo list item status to
|
||||
parents and children.
|
||||
|
||||
|
||||
*vimwiki-option-auto_tags*
|
||||
------------------------------------------------------------------------------
|
||||
Key Default value Values~
|
||||
@@ -3831,6 +3842,7 @@ Contributors and their Github usernames in roughly chronological order:
|
||||
- Benney Au (@chinwobble)
|
||||
- David Sierra DiazGranados (@davidsierradz)
|
||||
- Daniel Moura (@dmouraneto)
|
||||
- Tomáš Janoušek (@liskin)
|
||||
|
||||
==============================================================================
|
||||
16. Changelog *vimwiki-changelog*
|
||||
@@ -3842,6 +3854,8 @@ http://code.google.com/p/vimwiki/issues/list. They may be accessible from
|
||||
https://github.com/vimwiki-backup/vimwiki/issues.
|
||||
|
||||
New:~
|
||||
* Feature: #954: Add option |vimwiki-option-listsyms_propagate| to disable
|
||||
todo propagation to parents/children
|
||||
* Issue #1009: |foldmethod| syntax works for markdown (|g:vimwiki_folding|)
|
||||
Also the VimwikiHeader1Folding (1..60 regions support end-of-file `/\%$`
|
||||
as end maker
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
# Task list update, propagation disabled
|
||||
|
||||
Given vimwiki (Sample nested list, vimwiki syntax):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [ ] Child 2
|
||||
* [ ] Child 3
|
||||
|
||||
Execute (Set syntax to default):
|
||||
set sw=2
|
||||
call SetSyntax('default')
|
||||
call vimwiki#vars#set_wikilocal('listsyms_propagate', 0)
|
||||
|
||||
Do (Toggle top-level):
|
||||
\<C-Space>
|
||||
|
||||
Expect vimwiki (Only top updated):
|
||||
* [X] Top Level
|
||||
* [ ] Child 1
|
||||
* [ ] Child 2
|
||||
* [ ] Child 3
|
||||
|
||||
Do (Toggle child 1):
|
||||
j
|
||||
\<C-Space>
|
||||
|
||||
Expect vimwiki (Only child 1 updated):
|
||||
* [ ] Top Level
|
||||
* [X] Child 1
|
||||
* [ ] Child 2
|
||||
* [ ] Child 3
|
||||
|
||||
Do (Toggle all children):
|
||||
j
|
||||
\<C-Space>
|
||||
j
|
||||
\<C-Space>
|
||||
j
|
||||
\<C-Space>
|
||||
|
||||
Expect vimwiki (Only children updated):
|
||||
* [ ] Top Level
|
||||
* [X] Child 1
|
||||
* [X] Child 2
|
||||
* [X] Child 3
|
||||
|
||||
Given vimwiki (Deeply nested list, vimwiki syntax):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [X] Child 2
|
||||
|
||||
Do (Indent child 2):
|
||||
jj
|
||||
a\<C-D>
|
||||
|
||||
Expect vimwiki (Child 2 indent changed, checkmarks unchanged):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [X] Child 2
|
||||
|
||||
Do (Add child 3):
|
||||
jj
|
||||
o
|
||||
Child 3
|
||||
|
||||
Expect vimwiki (Child 3 added, checkmarks unchanged):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [X] Child 2
|
||||
* [ ] Child 3
|
||||
|
||||
Do (Add and indent child 3):
|
||||
jj
|
||||
o
|
||||
\<C-T>
|
||||
Child 3
|
||||
|
||||
Expect vimwiki (Child 3 added, checkmarks unchanged):
|
||||
* [ ] Top Level
|
||||
* [ ] Child 1
|
||||
* [X] Child 2
|
||||
* [ ] Child 3
|
||||
|
||||
Execute (Clean):
|
||||
set sw&
|
||||
|
||||
# vim: sw=2:foldlevel=30:foldmethod=indent:
|
||||
@@ -7,6 +7,7 @@
|
||||
##################
|
||||
|
||||
Execute (VimwikiIndex):
|
||||
call SetSyntax('markdown')
|
||||
VimwikiIndex 2
|
||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
AssertEqual 'vimwiki', &filetype
|
||||
|
||||
Reference in New Issue
Block a user