Closed Andy3153 closed 1 year ago
nvim-ufo can provide the marker
provider, but it's not able to combine the fold ranges between two providers using general setup.
Must program yourself under provider_selector
with require('ufo').getFolds
API.
https://github.com/kevinhwang91/nvim-ufo/blob/c412ff87165eb8712e2810799dfa90b728c40028/doc/example.lua#L20-L31
Look like #90 @msva is interested in this feature, close this issue because of duplicate.
@kevinhwang91
with require('ufo').getFolds
API.
And is it any documentation about how to extend the result of call to that function with custom folds?
@msva No, only source code https://github.com/kevinhwang91/nvim-ufo/blob/9e829d5cfa3de6a2ff561d86399772b0339ae49d/lua/ufo.lua#L109-L113
And search getFolds
and read related code from doc/example.lua
. You can also search getFolds
from GitHub issue, I remember that someone has asked for info about this API.
Feature description
Currently, while using this plugin, you can't use the fold markers you created previously. I'd like to have the possibility to use Vim's basic fold method, the manual one using the fold markers.
Describe the solution you'd like
The solution I'm proposing is to just replicate the original Vim foldmarker support while also having the advanced functionality of this plugin available.
Additional context
Some helpful stuff:
This will read the foldmarkers that are set by anything: be it user configuration, a plugin, the modeline etc.
Why isn't it perfect? Well, it renders pretty different results. Take a couple of examples (
%s
is a placeholder for the comment)--%s
(this example is expectable)/*%s*/
(for C/C++, it's apparently a multi-line comment, even though there's a single-line comment too)# %s
(yes, with a space, even though Python doesn't require that space for comments)So, using the commentstring isn't perfect, and it requires a bit more work. I just recommend going the Vim way and matching the foldmarkers wherever they appear in the text, I think it's the better way.