

^(update: just added a new link)^
- Neovim supports multiple ways to fold: https://neovim.io/doc/user/fold.html
- marker based folding: https://neovim.io/doc/user/fold.html#fold-marker
- introduction what folding is: https://neovim.io/doc/user/usr_28.html#usr_28.txt
The way you describe and show it, is called foldmethod “marker”. The advantage of markers are, that they are built into the file. The disadvantage is, its built into the file. I rather like having the source independent from folding markers. The good news is, you can change the foldingmethod in Neovim and ignore the marker comments and instead use your own method.
A simple one is just “manual”, where you set what is foldable and not. There are some automatic ones, like based on indentation and such. I was never a folding guy anyway, so don’t really know all the differences when to use and how they differ. Neovim has following foldmethod: manual, indent, expr, syntax, diff, marker. The “expr” method even allows you a custom code and logic.
This is a really good introduction.