Instead of using a range to focus an action, say:
5,10/booboo <-- to find "booboo" between lines 5 and 10
or
5,10g/booboo/d <-- to delete "booboo" between lines 5 and 10
I was wondering if I can search for the range within the command-line. (I understand the visual selection and act within that range.) All I can think of is to search for the first instance of a phrase and mark it:
:g/blahblah/mark a
Then the second instance:
:g/bleepbleep/mark b
Then perform what I want within that region:
:'a,'bg/booboo/d
I'm thinking there's a better way.
You can do this:
:/blahblah/,/bleepbleep/g/booboo/d
You can even get a little bit more fancy and send the cursor to the top of the document first:
:0;/blahblah/,/bleepbleep/g/booboo/d
See also :help [range]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With