In my config file I have set foldclose=all
so that folds get automatically
closed upon cursor leaving them. However, sometimes, I want a specific fold not
to close for a while.
Because folds below foldlevel=#
and folds smaller than foldminlines=#
are
not affected by foldclose=all
, there must exist a list of folds that
foldclose=all
doesn't work on.
I want to create a mapping that puts a particular fold (the one where my cursor
is) to that list so that it's temporarily not affected by foldclose=all
,
i.e., so that it doesn't close automatically even though foldclose
is set to
all
.
How can I add folds to those that foldclose=all
doesn't work on?
I did not find anything in the neovim documentation on
folds and tried to make a workaround by
using :mkview
but then I would have to have :loadview
triggered every time a
fold is closed, which I don't know how to do (and doesn't seem to be feasible
and efficient). I work in c++ and my default settings are foldlevel=1
,
foldmethod=syntax
, foldopen=hor
.
:help 'foldclose'
saysWhen set to "all", a fold is closed when the cursor isn't in it and its level is higher than 'foldlevel'. Useful if you want folds to automatically close when moving out of them.
So you would need a fold with level smaller thanfoldlevel
to not be affected byfoldclose=all
.