Use :mkview for restoring manual folds
This commit is contained in:
parent
a0e061a5cf
commit
75cdb17d99
@ -53,17 +53,26 @@ endfunction
|
|||||||
|
|
||||||
" Function: #disable {{{1
|
" Function: #disable {{{1
|
||||||
function! sy#fold#disable() abort
|
function! sy#fold#disable() abort
|
||||||
let &l:foldmethod = w:sy_fdm
|
let &l:foldmethod = w:sy_folded.method
|
||||||
normal! zO
|
let &l:foldtext = w:sy_folded.text
|
||||||
|
normal! zv
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: #toggle {{{1
|
" Function: #toggle {{{1
|
||||||
function! sy#fold#toggle(do_tab) abort
|
function! sy#fold#toggle(do_tab) abort
|
||||||
if exists('w:sy_fdm')
|
if exists('w:sy_folded')
|
||||||
call sy#fold#disable()
|
call sy#fold#disable()
|
||||||
unlet w:sy_fdm
|
if w:sy_folded.method == 'manual'
|
||||||
|
loadview
|
||||||
|
endif
|
||||||
|
unlet w:sy_folded
|
||||||
else
|
else
|
||||||
let w:sy_fdm = &foldmethod
|
let w:sy_folded = { 'method': &foldmethod, 'text': &foldtext }
|
||||||
|
if &foldmethod == 'manual'
|
||||||
|
let old_vop = &viewoptions
|
||||||
|
mkview
|
||||||
|
let &viewoptions = old_vop
|
||||||
|
endif
|
||||||
call sy#fold#enable(a:do_tab)
|
call sy#fold#enable(a:do_tab)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user