I have a file in which, below is the content.
A A A A A A A A A . . . A Piece of code... A A A . . A
I want something like this using folding in vim
- A Piece of code
- A
2 folds are created by folding repeated lines. This should happen automatically as I open the file. Is it possible by doing it in vimrc?
It should be possible by using
setlocal foldmethod=expr
where you can write your own function:However this is untested and you wouldn't want to do it for all files. But it should point you in the right direction. It also would not 100% match your criteria, but once you have a specific problem, you can always ask again