tmhedberg/SimpylFold

Possibility of defining custom folds?

ychnh opened this issue · 1 comments

ychnh commented

I would like to modify the plugin to allow custom folding based on markers.
(I have some groups of functions that I would like to hide all together. I want to put a markers between these functions and have SimpylFold automatically fold them as a group. These functions are part of a class and I would like to keep them within the class without using inheritance. )
How difficult would this be?

PS: Thank you for the great tool. It is very useful.

Vim has built-in marker-based folding (:set foldmethod=marker), but I'm assuming you know about that and want to combine marker folds with SimpylFold's syntax-based folds.

Unfortunately, there's no simple way to do this natively—Vim only allows one foldmethod at a time. It would take an update to this plugin to look for markers in the buffer and add folds for them in addition to the existing folding heuristics. I don't think this would be too challenging to accomplish, but you would probably need to work on it yourself, as I don't really plan on adding more features on my own time. If you feel inclined to implement it, I'd consider merging it.