masukomi / vim-markdown-folding

Fold markdown documents by section.
248 stars 43 forks source link

Tab-indent the foldtext depending on header level #26

Closed augustus-rex closed 5 years ago

augustus-rex commented 7 years ago

adds tabindents to the foldtext for header level 2 and above. This makes it easier to distinguish different levels. Instead of this:

# H1
## H2
### H3 

It looks something likes this

# H1
  ## H2
    ### H3
mlovic commented 6 years ago

Very helpful, thanks! (I've incorporated it into my fork, it doesn't look like the maintainer is active...)

augustus-rex commented 6 years ago

I guess I'm the maintainer. And no, I'm not active. But glad to see someone has use of this! ^^

On 15 May 2018 17:55:42 CEST, Marko Lovic notifications@github.com wrote:

Very helpful, thanks! (I've incorporated it into my fork, it doesn't look like the maintainer is active...)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/nelstrom/vim-markdown-folding/pull/26#issuecomment-389219102, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AS1_-u_Ug2pydtHsJajdAy6qUYkHg5mRks5tyvp-gaJpZM4MpX9-.

masukomi commented 5 years ago

new maintainer here @augustus-rex & @mlovic

This looks interesting. I've merged in a number of other changes which result in a conflict in this which i haven't investigated. I'll see if i can get it working and then ponder it after seeing it on a more "real" test doc.

thanks for the PR @augustus-rex

masukomi commented 5 years ago

Ok, I took a look at it with the other new code @augustus-rex While I appreciate the PR I don't think we should take in these changes right now. Here's my thinking

The initial problem is that it kinda screws with the alignment of the [x lines] indicator. Here's an example with only one tab of indentation per level.

  1 #     Topmost heading                         [3 lines]-------------------------------------------------
  5  ##    Second level heading                    [3 lines]------------------------------------------------
  9   ###   Third level heading                     [3 lines]-----------------------------------------------
 13   ###   Another third level heading             [2 lines]-----------------------------------------------

I think that could be addressed easily enough. Two tabs per level is probably going to be an issue with an H6 though. That's twelve tabs of indentation. Not so bad if you have a tab displaying as 2 spaces but some put them as wide as 8. I think replacing it with something more controllable like spaces might address it but...

I'm not convinced the aesthetics of it are helpful to readability when you've got paragraphs of non-headers in between.

Feel free to open up a feature request issue for adding indentation. Maybe the community wants it. We'll see.