0

When I open a help page, create a manual fold, set bufhidden=hide and buflisted, then navigate away from that page, the fold is not restored upon returning.

$ vim -u NONE
:help
" create a manual fold
zf 20j
:set bufhidden=hide
:set buflisted
" navigate to another buffer
:bnext
" navigate back to the help buffer
:bnext
" at this point, there are no manual folds on the help page

Using :mkview and :loadview results in the fold being restored.

Is there some setting that would cause manual folds to be retained in this scenario without requiring the usage of :mkview and :loadview?

0

Temporarily changing 'buftype' to <empty> prevents the folds from being lost.

$ vim -u NONE
:help
zf 20j
:set bufhidden=hide
:set buflisted
" temporarily change buftype to <empty>
:set buftype=
:bnext
:bnext
" change buftype back to help
:set buftype=help

Setting 'buftype' back to help goes against the warning added in commit 071d427 on Jun 13, 2004:

"you are not supposed to set this manually"

Neovim updated the text in commit 2e1217d on Nov 10, 2016.

"do not set this manually"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.