Delete, copy, and paste linux vim shortcut keys
Delete
In lowercase, x indicates that a character is deleted backward, that is, the character where the cursor is located is deleted.
Nx n indicates a number, indicating that each character is deleted backward. For example, 10x indicates that the last 10 characters including the cursor are deleted.
X in uppercase indicates that a character before the cursor is deleted, excluding the character where the cursor is located.
NX n indicates a number, indicating to delete each character forward. For example, 10X indicates to delete the first 10 characters before the cursor,Excluding the cursorCharacter
Dd deleting the row where the cursor is located is actually cutting
Ndd n indicates a number. Delete the n rows down the cursor.
D1G delete data from the row where the cursor is located to the first row
DG deletes the data from the row where the cursor is located to the last row
D0 deletes the first character from the row where the cursor is located
D $ Delete the last character from the row where the cursor is located
Yy copy the row where the cursor is located
Nyy n indicates a number. Copy the n rows down the cursor.
Y1G copy the data from the row where the cursor is located to the first row
YG copies the data from the row where the cursor is located to the last row.
Y0: copy the cursor to the first character of the row
Y $ copy the cursor to the last character of the row
P indicates that the copied data is pasted to the next row of the cursor.
P indicates that the copied data is pasted on the top line of the cursor.
J. Merge the row where the cursor is located with the data of the next row into one row.
U indicates detaching the previous operation (especially important, similar to crtl + y in word in windows)
Ctrl + r is opposite to u, which indicates redo the previous step (especially important, similar to crtl + y in word in windows)
.To repeat the previous operation. For example, if you want to copy multiple times, keep following thisPointThat's all.
Note:The deletion, copy, and paste operations are performed in non-editing mode.