When a fold is collapsed in vim, all of the nested headings are hidden away so that you can't see what's inside. I'm curious if anyone knows if it's possible or has a solution for foldtext function (or through another method) that can display the sections inside a fold when a fold is collapsed.
I'm looking for something that would display folds more like this:
+ -- 2000 TopSection1 " Fold Level 1
+ --- 500 TopSection1 : ChildSection1 " Fold Level 2
+ ---- 50 TopSection1 : ChildSection1 : BottomSection1 " Fold Level 3
+ --- 100 TopSection1 : ChildSection2 : BottomSection1 " Fold Level 2
+ -- 500 TopSection2 " Fold Level 1
+ --- 25 TopSection2 : ChildSection1 " Fold Level 2
I've been digging around, but have not figured out a method to make this work (or if it's possible). Any suggestions?
I use zr and zm normal commands to open and close another folding level. I agree that zr will also show text between a folding level and a sub-level ; hence it does not fully address your question. It's seems that a better way would be to use foldmethod=syntax and then filter all folding lines with a global (g) command based on the regex of the foldmethod syntax.