How might Ι automatically fold all paragraphs where every line begins with %%? Would be good for comments in TeX.


Try this setting:

 :set foldenable foldmethod=expr foldexpr=getline(v:lnum)=~'^\s*%%'
  • Thanks! it seems, though, that with this setting, it is no longer possible to create folds without this pattern with :fold. – Toothrot Oct 17 '15 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.