0

With foldmethod=indent, I can create folds based on the indentation level, e.g. this

- foo
  - bar
  - baz
- qux

would be folded into this:

- foo
+ -- 2 lines folded ------------------------------------------------------------
- qux 

Is it possible to include the first line of the previous level into the fold? That is,

+ -- 3 lines folded ------------------------------------------------------------
- qux 
3
  • 1
    I can't see any option that would enable this in :help fold.txt; I think you'll have to use foldmethod=expr and write a small foldexpr function (e.g. count shiftwidth() of current line + count shiftwidth() of next line). Aug 17, 2022 at 17:21
  • @MartinTournoij, I guess so too, thanks! Could you suggest a sample expression? I will accept it as an answer :) Aug 18, 2022 at 9:12
  • 1
    @Rich, yes! And thank you very much for the foldexpr 💙 Aug 19, 2022 at 10:20

0

Browse other questions tagged or ask your own question.