would like a :refold command`
command! -range -addr=windows Refold call ResetWinOpts(<line1>, <line2>, ['fdm', 'fdl', ...])
command! RefoldAll tabdo %Refold
" reset options through a window-range to global values
function! ResetWinOpts(winid1, winid2, opts)
call execute(printf("%s,%swindo setl %s<", a:winid1, a:winid2, join(a:opts, "< ")))
endfunction
If you're only interested in undoing all effects of manual folding, like za/zo/zc
etc. then, as @ChristianBrabandt suggested in the comments, the command zX
will do this for you.
:e!
do what you want?:enew | e#
. But I doubt it should be recommended.:e!
has always reset the folds for me. not sure why you would recommend opening the same file in a different window so.za
and other such commands which influence only individual folds, but not any of the window folding options. But if you ever usezR
, or something like that, then its effect of setting localfoldlevel
will remain after:e!
zX
might be helpful.