I would like to know if it is possible to delete till the start of a pattern on another line.
p.e.
- good morning |
- empty line
- empty line
- empty line
- ….
- empty line
- hello world
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 generaldcommand as follows (^ is your cursor)Type
d/thethen press enter. It will delete from the cursor to the beginning of the first search match, leaving you with