kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.3k stars 47 forks source link

A more compact option to set the folding text #88

Closed Karmenzind closed 1 year ago

Karmenzind commented 1 year ago

Feature description

The lua config file is too long. Now I have to add 37 more lines to set the folding text. Please provide a more compact option to set the folding text. Like this:

default_folding_format = '{lines} custom text {start-line} blabla'

Or a function like the builtin foldtext() in vim which is only about the string itself.

Thanks a lot.

Describe the solution you'd like

Maybe you can wrap the handler function example as a default folding template accepting a format string, and provide an option to set it. It will be good enough for many people and we only need to write one line.

Additional context

No response

kevinhwang91 commented 1 year ago

There are many context need to expose to users.

foldtext() only depend on string. but the content of the fold is actually virt_text that depends on a list of {text, highlight } . The color folds are not the standard of ufo, ufo should respect virt_text with extmarks api.

If you think 37 loc is large for you, I think the default style is not bad compared with the raw foldtext().