Search code examples
vimintellij-ideafolding

Inline folding in Vim


Is it possible to do inline folding in Vim as IntelliJ does:

IntelliJ inline folding

In Vim, it is possible to customize the inline heading but what IntelliJ does is different: The line contains some normal, visible text and some hidden, folded text together.


Solution

  • Yes it is. You have to play with &foldtext, and may be you'll also have to write your own &foldepxr in order to fold how you want.

    You can find an example in my (newly published) VimFold4C. I merge function parameters, I indent folded text, and I remove template parameters and namespace depending on an option.

    NB: I still have issues with fold boundaries detections, and I had to use dirty hack to speed up the fold detection.