Hacker News new | ask | show | jobs
by ThatGeoGuy 1855 days ago
This can be done in (neo)vim too, and with a bit better precision and less typing.

:g/<regex>/<command>

is the general form for [g]rabbing lines that match a regex and applying a command over them. You can also chain the command:

:g/<regex1>/g/<regex2>/<command>

I'll admit this isn't exactly something you intuit as easily as a drop-down menu, but (neo)vim does have tools for all these things out of the box.

1 comments

Huh, somehow it’s never occurred to me to get binary logic by chaining :g and :v in this way—I’ve always done things in more complicated ways to make up for the lack.