I would like to know if it is possible to delete till the start of a pattern on another line.
p.e.
Is it possible to delete from cursor "|" in line 1 till "world in line 7? (remaining in normal mode)
I do this often. Normally I use "dd" to delete all lines between line 1 and line 7 and then delete to word "dfw" but this is quit difficult if I'm on line 347 and my text is on 381. I have to count the lines between them and often I delete one line too much.
Rather than using dd
(which deletes a single line), you can use the more general d
command as follows (^ is your cursor)
^The quick
brown fox
jumped over
the lazy
dog
Type d/the
then press enter. It will delete from the cursor to the beginning of the first search match, leaving you with
the lazy
dog
You can search for "world":
d/world<Enter>
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