As a result of this answer here, I'm trying to write a
foldexpr for vim which is equivalent to
foldmethod=indent (as a starting point to then enhancing it to recognise my custom markers, see the question for more details).
I've tried this:
set foldmethod=foldexpr set foldexpr=indent(v:lnum)
However, this fails on this simple HTML example:
<div id="a"> <div id="b"> <div id="c"> <div id="d"> </div> </div> <div id="e"> </div> </div> </div>
If I place my key on the
<div id="c"> line, and hit
zc, the fold works as expected and folds only that div. If I re-open, then place my key on the
<div id="b"> line, and hit
zc, the fold fails as
<div id="e"> is not folded.
If I switch to
foldmethod=indent, this doesn't happen; the second fold is performed correctly. How can I fix my
foldexpr to make it behave like