The d{motion}
command seems to work inconsistently:
d1j " deletes 2 lines to the bottom
d1l " deletes 1 character to the right
Is it expected behaviour?
Replace “<WORD>” with the word of the line you want to delete. For example, if you want to delete lines with the word “Linux”, then use the following approach: Press the “Esc” key to change mode. Type “:g /linux/d”, then hit “Enter”.
Deleting Multiple Lines in Vi and VimInstead of simply pressing dd, you can specify the number of lines you want to delete. For example, typing 3dd will delete the next three lines from the file. You can also use wildcard characters in the aforementioned command.
Deleting a Line Press the Esc key to go to normal mode. Place the cursor on the line you want to delete. Type dd and hit Enter to remove the line.
When you start a motion and you are in operator pending mode, your motion will be either inclusive or exclusive, and either characterwise or linewise (linewise motions are always inclusive).
j
is a linewise inclusive motion. Probably you want to try dvj
or dgj
(the latter one works with screen lines).
See :help operator
. You can force motions to be linewise, characterwise or blockwise with V, v or CTRL-V respectively.
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