There is a setting, but unfortunately, 20 is the maximum supported number of nested folds. See :help 'foldnestmax'
:
Using more than 20 doesn't work, because the internal limit is 20.
You could try working around this by using a custom fold expression. Note that the indent()
function can be used in 'foldexpr'
to get the indent of a line. There may also be plugins that provide slightly different styles of indent folding. Update: Christian Brabandt points out in the comments that my interpretation of the :help was inaccurate. While the 'foldnestmax'
option applies to the indent and syntax methods, the internal limit is hard coded across all fold methods.