Is there a way to hide all lines that did not match, while going through the list of result lines?
In a long file, I would like to search for a pattern that will match roughly 200 lines or so. The matched lines are in random places in the file.
When a line matches, only the line itself is relevant, no context above or below.
Normally, I would search with / and jump through the matches with n.
But that means there are only one or two relevant lines on the screen at a time.
A brute force approach would be to delete all non-matching lines, and undo that deletion later. But that's ugly in various ways, even if it would not end up in persistent undo.
:vimgrepcan be abbreviated to:vim– D. Ben Knoble Jun 11 '18 at 14:51:ccl[ose]or however you normally close a buffer (e.g., switch to it and:bd). You can reopen the quickfix buffer by running:cw[indow]again, and it will use your last vimgrep results. – Zach Ingbretsen Mar 23 '19 at 12:59:vim YOUR_SEARCH %and:cw, usectrl_w,ctrl_wto switch between frames – sjas Mar 05 '22 at 14:18%trick will not work on a[No Name]buffer (E499: Empty file name for % or #). – Arnie97 Mar 22 '23 at 08:51