dd can delete the line where the current cursor is located. If you want to delete multiple lines, you can add the number of the line to be deleted in front of dd
Shift + v is to select by row, ctrl + v is to select by block (select by column), then x and d can be deleted, similar to cutting, you can also use p to paste back. x alone deletes the current character, dd deletes the current line, and adding a number in front means repeating it N times.
In normal mode, you can use the x command to delete a single character, and the d command to delete more characters: d motion.
motion is a command indicating the operating range. For the motions that appear in the following content, please refer to the table here:
Button | Definition
| Position the cursor at the beginning of the line
$ | Position the cursor to the end of the line b | Position the cursor to the beginning of the word under the cursor e | Position the cursor to the end of the word under the cursor w | Position the cursor to the beginning of the next word gg | Position the cursor to the beginning of the file G | Position the cursor to the end of the file
If you want to delete more characters, you can use the c command: c motion, which is similar to the d command. The difference is that after deletion, you enter insert mode.
dd can delete the line where the current cursor is located. If you want to delete multiple lines, you can add the number of the line to be deleted in front of dd
In addition to the two people above, there is also a way to delete the content after the cursor in the line, press dt$
Ctrl+v
选中需要删除的行,d
Just a moment and it’s OK!Shift + v is to select by row, ctrl + v is to select by block (select by column), then x and d can be deleted, similar to cutting, you can also use p to paste back.
x alone deletes the current character, dd deletes the current line, and adding a number in front means repeating it N times.
In normal mode, you can use the x command to delete a single character, and the d command to delete more characters:
d motion
.motion is a command indicating the operating range. For the motions that appear in the following content, please refer to the table here:
Button | Definition
| Position the cursor at the beginning of the line
$ | Position the cursor to the end of the line
b | Position the cursor to the beginning of the word under the cursor
e | Position the cursor to the end of the word under the cursor
w | Position the cursor to the beginning of the next word
gg | Position the cursor to the beginning of the file
G | Position the cursor to the end of the file
If you want to delete more characters, you can use the c command:
c motion
, which is similar to the d command. The difference is that after deletion, you enter insert mode.