Vim commands
Small knowledge, big challenge! This paper is participating inEssentials for programmersCreative activities.
Start Basic VIM command query manual. Learn these routines to keep the hand 👋 off the mouse 🖱️Copy the code
Insert text
code | semantic |
---|---|
i |
Insert at the current cursor |
I |
Insert at the beginning of line |
a |
Pre-cursor insertion |
A |
Insert at the end of line |
o (lowercase) |
Add a line to the top edge of the row |
O (capital) |
Add a line below the line |
Delete the text
code | semantic |
---|---|
dd |
Deletes the line where the cursor is located |
x |
Deletes the character where the cursor is located |
X |
Deletes the character before the cursor |
dw |
Delete a word |
d^ |
Delete to the beginning of the line |
D |
Delete to end of line |
d$ |
Ditto ⬆ ️ |
dG |
Delete to the end of the article |
d1G |
Delete to the top of the article |
Copy/Paste
code | semantic |
---|---|
y |
Copy the character where the cursor is located |
yy |
Copy the current row |
y^ |
Copy to the beginning of the line |
y$ |
Copy to the end of the line |
yw |
Copy a word |
y2w |
Copy two words (and so on) |
yG |
Copy to the end of the article |
y1G |
Copy to the top of the article |
p (lowercase) |
Paste after the cursor |
P (capital) |
Paste in front of the cursor |
Select the text
code | semantic |
---|---|
v |
Select by character |
V |
According to the line to choose |
ctrl + v |
According to the column |
Replace text
code | semantic |
---|---|
R + the replacement character |
Replace current character |
R |
Successive replacement characters press ESC to leave |
cc |
Rewrite the line |
cw |
Rewrite a word |
C |
Replace until line mo content |
{n}c |
Undo n operations |
U |
Undo all changes in the row |
ctrl+r |
The undo operation of recovery |
jump
- Row to jump
code | semantic |
---|---|
nG |
Jump to line n |
ngg |
Jump to line n (ditto) |
gg |
Jump to the first line |
G |
Jump to the last line |
ctrl+o |
Return to the position before the jump |
- Inline jump
code | semantic |
---|---|
w |
Go to the beginning of the next word |
e |
To the end of the word |
b |
The beginning of the previous word |
ge |
The end of the previous word |
0 |
Line at the beginning |
^ |
Line beginning (ditto) |
$ |
Line at the end |
set nu
Displays the line number before each line
search
code | semantic |
---|---|
F + letters |
Look back to the position where the first letter appears |
F + letters |
Look forward to the position where the first letter appears |
/ |
Look up words backwards |
? |
Look forward to the word |
supplement
- Prefixed a command with a number such as
3dd
Delete 3 lines to save repeating code