Vim folding for TeX

Aeons ago, I wrote a small Vim plugin for folding TeX sources. It was a pathetic attempt, that never worked well and finally sunk into the depths of forgotten repositories.

Fast-forward to today and you can see me in love with folds. I’ve never been a big fan of them, but I began to like the idea after I started sprinkling markers in files which do not have a syntactic hierarchy (e.g. configuration files). To make a long story short: I revived the plugin and released a first version on

As of now, it works reliably with any kind of section and \begin{}\end{} environments. I also added regex matches for marker pairs, so you can use them in the same document as the expression folds. This is useful to group configuration sections and hide them when not editing them1. I also added a foldtext function that removes all the TeX cruft and adds little Unicode icons in front of the particular fold text.

Again, if you have any suggestions or problems, don’t hesitate to open an issue on the [issue tracker][].


Which happens most of the time. And which required skipping large swaths of text, everytime I open a TeX file. [issue tracker]: