Acting on every matching line
Vim has a famous command for this job: :g/pattern/d deletes every line
matching a pattern. Helix has no :g. Instead, you build the same thing out
of pieces you already know, and you get to see the lines before they go.
The trick is that s selects the match, not the line. x fixes that: it
grows each selection to cover its whole line, including the line break. So
the Helix spelling of “delete every line matching HAYSTACK” is:
%to select the whole buffers,HAYSTACK,Enterto put a cursor on every matchxto grow each cursor into its full linedto delete them
Four keys, and you get to check the highlights between each one. Swap the
d for y and you’ve yanked every matching line instead; swap it for c
and you’re rewriting them.
Work through the checklist below to clear the haystack.