1. Direction key
H: equivalent to left button
L: Equivalent to right-click
K: equivalent to the upper key
J: equivalent to the next key
###############################################################
2. Move the cursor
Move the cursor to the first line of the file GG
Move the cursor to the last line of the file G
Move the cursor to the nth row of the file Ngg
Move the cursor to the beginning of this line 0 (number 0)
Move the cursor to the end of the line in this line $
###############################################################
3. Editing (mobile editing)
Insert a row below the current line and enter edit mode o (lowercase letter O)
Insert a row above the current line and enter edit mode O (capital letter O)
Delete the contents of the cursor at the end of the line and enter edit mode C (capital letter C)
Delete the position of the cursor at the end of the line D (Capital letter D)
Quickly reach the end of the line and enter edit mode a (capital letter a)
###############################################################
4. Copy Delete Paste
Copy yy
Copy cursor location down multiple lines Nyy
Paste P
Paste NP multiple times
Delete/Cut DD
Delete the contents of the current line to the end of the file DG
###############################################################
5. Batch Operation
1) Bulk Delete
CTRL + V enters visualization mode
Press the up and down keys to select the area you want to delete
Delete D
2) Batch Increase
CTRL + V enters visualization mode
Press the up and down keys to select the area to add content to
Press SHIFT + I (lowercase letter i)
Edit the content you want to add
Press and hold the ESC key to exit
################################################################
6. Other
Show line number set Nu
Suppress line number set Nonu
Find
/+ What you're looking for n (lowercase letter) Continue search down N (capital letter N) continue to search up
Undo Current Operation U (lowercase letter u)
Restore the Operation Ctrl+r
################################################################
7. Common faults
When the Vim editor suddenly loses power or interrupts, and then edits the file, it prompts for temporary file existence.
Exit by Capital Letter Q
Then Vim-r soft.txt continue to edit save exit Wq can
Finally, delete the temporary file. SOFT.TXT.SWP (picture red box Callout)
Delete temporary files rm-f. soft.txt.swp
You can recover the data.
Vim Common shortcut key series