Commonly used shortcut operations
Note: It needs to be done in vim specified mode
1. Copy the current line
In normal mode
- Move the cursor to the specified line
- enter
yy
- Then enter
p
(representspaste
paste)
2. Copy the current line 3 lines down
In normal mode
- Move the cursor to the specified line
- enter
3yy
- Then enter
p
(representspaste
paste)
3. Delete the current line
In normal mode
- Move the cursor to the specified line
- enter
dd
4. Delete 6 lines below the current line
In normal mode
- Move the cursor to the specified line
- enter
6dd
5. Quickly jump to the first line of the document
In normal mode
- Move the cursor to the specified line
- enter
gg
6. Quickly jump to the last line of the document
In normal mode
- Move the cursor to the specified line
- enter
G
6. Quickly jump to the last line of the document
In normal mode
- Move the cursor to the specified line
- enter
G
7. Quickly jump to line 20 of the document
In normal mode
- enter
20
- Enter
shift
+G
8. If you entered "xxxx" or deleted some data by mistake, undo the action.
In normal mode
- enter
u
9. Display the line number of the file
In command mode
- Enter
set nu
, press Enter
10. Hide file line numbers
In command mode
- Enter
set nonu
, press Enter
11. Quickly search for specified keywords
In command mode
- Enter
/
+ keyword and press Enter to search - If there are multiple matching keywords, enter
n
to find the next one