pseewald / vim-anyfold

Language agnostic vim plugin for folding and motion based on indentation.
MIT License
268 stars 11 forks source link

Allow for Markdown-style (and/or other style) of Headers #42

Open jeetsukumaran opened 3 years ago

jeetsukumaran commented 3 years ago

Currently, when using anyfold to fold away lists in a plain text files, any section headings in the file get confused as part of the list.

For e.g., given

# Heading 1

## Heading 1.1

-   List level 1
    -   List level 2
        -   List level 3
        -   List level 3
    -   List level 2
        -   List level 3
        -   List level 3

## Heading 1.2

-   List level 1
    -   List level 2
        -   List level 3
        -   List level 3
    -   List level 2
        -   List level 3
        -   List level 3

## Heading 2

## Heading 2.2

-   List level 1
    -   List level 2
        -   List level 3
        -   List level 3
    -   List level 2
        -   List level 3
        -   List level 3

## Heading 2.2

-   List level 1
    -   List level 2
        -   List level 3
        -   List level 3
    -   List level 2
        -   List level 3
        -   List level 3

we see:

Screenshot from 2021-09-25 22-34-40

Would it be possible to have vim-anyfold optionally recognize these headings and not fold them, so it looks like this:

Screenshot from 2021-09-25 22-37-19

This can be a command, e.g., "AnyFoldIncludeTextHeaders on" (which will fold headers, as it does now, by default), "AnyFoldIncludeTextHeaders off" (which will result in the second case).