Is there a command to delete a line (or several lines) that is immediately below current line?
Currently I’m doing it as:
jdd and then . to repeat as needed.
Is there a command that would combine all these?
UPDATE: The reason I would like to have such command is that I don’t like to move away from current position, yet be able to delete lines below.
The delete ex command will work nicely.
This will delete all the lines from current +1 till the end ($)
To delete the next 2 lines the follow range would work,
+1,+2or shorthand+,+2As @ib mentioned the
:deleteor:dcommand will move the cursor to the start of the line next to the deleted text. (Even withnostartoflineset). To overcome this we can issue the``normal mode command.``will jump back to the exact position before the last jump, in this case the:dcommand. Our command is now:+,+2denter``
Or as one ex command
To make this easier we wrap this all up in a command:
Now to delete the next following 3 lines:
This command can also take a
{reg}like:deleteand:yankdo. So deleting the next 4 lines into registerawould be:For more information