diff --git a/doc/taskwiki.txt b/doc/taskwiki.txt index 44865cf..ddecc42 100644 --- a/doc/taskwiki.txt +++ b/doc/taskwiki.txt @@ -663,6 +663,10 @@ constructs. use the same colors for task highlighting as those defined in taskwarrior. +*taskwiki_dont_preserve_folds* + If set to a non-empty value (such as "yes"), taskwiki will not + preserve folding when entering or leaving a vimwiki buffer. + *taskwiki_disable* Setting any non-empty value for this variable will disable taskwiki. diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index f0e58c5..061cd14 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -30,9 +30,11 @@ augroup taskwiki autocmd! " Update to TW upon saving execute "autocmd BufWrite *.".expand('%:e')." TaskWikiBufferSave" - " Save and load the view to preserve folding - execute "autocmd BufWinLeave *.".expand('%:e')." mkview" - execute "autocmd BufWinEnter *.".expand('%:e')." silent loadview" + " Save and load the view to preserve folding, if desired + if !exists('g:taskwiki_dont_preserve_folds') + execute "autocmd BufWinLeave *.".expand('%:e')." mkview" + execute "autocmd BufWinEnter *.".expand('%:e')." silent loadview" + endif augroup END " Global update commands