ftplugin: Avoid changing global viewoptions

As mentioned in an earlier commit, viewoptions is global, so it's
probably best to override it only temporarily for mkview.

(loadview is moved to autoload just for symmetry and in case we need to
do something more complex, like saving/restoring foldmethod, later)
This commit is contained in:
Tomas Janousek 2020-12-18 16:57:38 +00:00 committed by Tomas Babej
parent 7b72ee47b9
commit a6907bac85
2 changed files with 14 additions and 4 deletions

View file

@ -1,6 +1,18 @@
if exists('g:loaded_taskwiki_auto') | finish | endif
let g:loaded_taskwiki_auto = 1
function! taskwiki#MkView() abort
let viewoptions = &viewoptions
set viewoptions-=options
mkview
let &viewoptions = viewoptions
endfunction
function! taskwiki#LoadView() abort
silent! loadview
silent! doautocmd SessionLoadPost
endfunction
function! taskwiki#FoldInit() abort
" Unless vimwiki is configured to use its folding, set our own
if &foldtext !~? 'VimwikiFold'