Closed inkarkat closed 10 years ago
This seems a little bit strange to me. It fits ok when using the flat folding style (where everything is effectively foldlevel 1), but it feels awkward when using the nested folding style. With this as a sample text:
# One A
Lorem ipsum...
## Two A
Lorem ipsum...
---
## Two B
Lorem ipsum...
If I place my cursor on the ---
horizontal rule and press zo
, it increments the fold level from 2 to 3, but doesn't open the fold. If I press zo
again, the foldlevel goes from 3 to 4, and still doesn't open the fold. Repeat zo
again and again, and eventually when it reaches 7, the fold opens.
I feel uneasy about this. In general, I try to make my headers spell out a table of contents for the document. An <h3>
can follow an <h2>
(parent) or another <h3>
(sibling), but an <h3>
should not come after an <h1>
(grandparent). Treating <hr>
as an <h7>
feels like a violation of this guideline.
I'm afraid that's the best one can do with Vim's sequential fold levels.
If you have the foldcolumn visible, you'll notice the deep nesting and then use zO
instead of zo
(which due to its required repetition is indeed close to useless).
Despite its quirks, I still find this useful overall. Not all documents are neatly hierarchically structured...
I'm still not convinced that this is worth adding. Also, this test would need reviewing, as it breaks with this patch.
Well, it's your call. Feel free to close this issue; I can always keep using this in my private fork. If others find this useful, they can add their comments here and re-open an issue.
Ok, let's close this for now. We can re-open it later if necessary.
According to John Gruber's spec and the Stack Overflow implementation, horizontal rules are defined by three or more hyphens, asterisks, or underscores (optionally separated by spaces) on a line.
Since horizontal rules are a (weak kind of) structuring mechanism, include them as foldlevel 7, after all possible headings.