Thanks to https://github.com/scottmcginness/vim-foldtext for the original code base this foldtext routine began from.
Use your preferred plugin manager to install
- Respects indent level
- Handles dynamic toggling of sign/fold/number columns
- Line count info can be toggled with
let g:FoldText_info=!g:FoldText_info
- Use indentLine for fold-line shown in example as an alternative to foldcolumn lines