According to the documentation, the only command that recompute folds is the zx
command. However, the problem is that zx
automatically undoes all manually opened or closed folds. If I have a bunch of folded text prior to running zx
, all of those text would be unfolded (and the folds disappear) after I run zx
.
My current solution is to define an autocommand to run set foldmethod=expr
at every InsertLeave
and TextChange
event. However, I can't help but find this solution a bit 'hackish' and inelegant.
If anyone knows a better way, please point me in the right direction.
zx
.