I like folding a lot. I like code syntax based folding, custom marker based folding, folding multi line comments, folding parentheses, folding braces, and probably other things I am forgetting. To accomplish this I write custom syntax files and use the syntax fold method, which I hate a lot. Is there a better way?

As a specific example, I am not aware of any way to combine code syntax folding (like C style folding) and custom marker based folding ({{{ }}}) other than to write a custom syntax file. I really like using custom marker folds to keep things organized.

My problem with using the syntax method with custom syntax files is that I find them incredibly finicky and frustrating. If there exists a repository of existing syntax files that include various alternate folding rules I would find that useful.

My ideal solution would be to be able to specify a list of independent folding "situations" that are efficiently computed and don't mess up the existing syntax and which don't require me to write syntax rules.

  • Welcome to vim :-) Your question is somehow vague. Could you share with us the downside of your method? In particular how the buildin syntaxes do not fit your need? May 27, 2022 at 5:55
  • 1
    You are probably right, in the sense that I am not convinced that there does exist a better method. But I find that I am repeatedly wrong about such things. May 27, 2022 at 6:39


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.