Several modes of VIM switching
Insert command
Command |
Role |
A |
Insert in the word specifier the cursor |
A |
Insert at the end of the line where the cursor is |
I |
Insert in the word match either the cursor |
I |
Insert at the beginning of the line at which |
O |
Insert a new line under the cursor |
O |
Insert a new line on the cursor |
Position command
Command |
Role |
: Set Nu |
Set Display line numbers |
: Set Nonu |
Suppress line numbers |
Gg |
To the first line |
G |
To the last line |
NG |
to Nth row |
: N |
to Nth row |
$ |
To end of line |
0 or ^ |
To the beginning |
Delete command
Command |
Role |
X |
Delete the character at the cursor location |
Nx |
Delete the n characters at the cursor (including at the cursor) |
Dd |
Delete the cursor in the row |
Dg |
Delete the line of the cursor to the end of the file |
D |
Delete the contents of the cursor at the end of the line |
: n1,n2d |
Delete the contents of the N1 to N2 line: 1,3 wounds 1 to 3 rows |
Copy and cut
Command |
Role |
Yy |
Copy when moving forward |
Nyy |
Copy the following n rows of the current row (including the current row) |
Dd |
Cut when moving forward |
Ndd |
Cut the following n rows of the current row |
P,p |
On the line where the current cursor is located, paste |
Replace and cancel
Command |
Role |
R |
Instead of the character at the cursor, press R again to replace the result |
R |
To replace a string from where the cursor is located, press ESC to end |
U |
Undo action from the previous step |
VIM Basic operation