SimpylFold
SimpylFold copied to clipboard
Optionally fold other common blocks
To browse long functions, I sometimes wished that if
, elif
, else
, for
, while
, try
and except
blocks were also folded by SympylFold. Would it be difficult to have them optionally folded ? Or maybe just if they were more than n
lines long, something like:
let g:SimpylFold_fold_import = 0
let g:SimpylFold_fold_docstring = 1
" but also:
let g:SimpylFold_fold_ifelifelse = 5 " fold if more than 5 lines long
let g:SimpylFold_fold_for = 1 " always fold
let g:SimpylFold_fold_while = 0 " never fold
let g:SimpylFold_fold_tryexcept = 10 " fold if more than 10 lines long
.. or.. maybe it would be a nightmare?
I don't think it would be difficult. It might be a nightmare of configuration options. :)
Usually, the minimum number lines within a fold is determined by Vim's built-in foldminlines
option. If you want to set different minima for different fold types, that might get complicated, especially when it comes to figuring out how to interact with foldminlines
in an intuitive way. But Boolean options to turn on and off folding of different types of blocks should be fairly straightforward.
That said, it's not something I'm interested in implementing myself, as I doubt I'd use it, and my preference is generally to keep this script simple rather than adding features. I would consider a pull request, though, if you wanted to send one.
Alright, I'll get into this if I find spare time.. not quite soon of course ;)
(I didn't know Vim only had one foldminlines
option, this'll make it trickier for sure :\ )
Thank you for support!