How do I fold many lines and then do a search so that only the lines with search hits pop up while all the rest stay folded? This is how text editors of the 1970s worked. Much appreciated if you can spare the time to respond.
1 Answer
One way you could do it is with the command:
:g/PATTERN/norm!zv
This runs the command zv
on every line that has a match for your search PATTERN
. zv
opens as many folds as are necessary to make the current line unfolded.