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 1


One way you could do it is with the command:


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.