Command line shortcuts
ctrl + a // Move the cursor to the front
ctrl + e // Move the cursor to the rearmost
ctrl + l // clear screen
ctrl + c // cancel
ctrl + u // Move the cursor to the beginning of the delete
ctrl + k // Remove backward the command string
Esc +. Get the last part of the previous command (space separated)
Esc + b Move to the beginning of the current word.
Esc + f Move to the end of the current word.
Related operations in vim command mode
Cursor moves to the beginning of the line: 0
Cursor moves to the end of the line: $
Cursor moves to the head of the file: gg
cursor moves to the end of the file: G
cursor quickly moves to the Nth line: nG
deletes the character before the cursor: X
deletes the character after the cursor: x
Delete the line where the cursor is: dd (actually a cut operation)
delete n lines: ndd
undo: u
reverse undo: Ctrl + r
copy a line: yy
copy N lines: nyy
paste the next line where the cursor is: p
paste to the cursor The previous line: P
[Ctrl] + [f] 『Down』 Move one page, equivalent to [Page Down] button (common)
[Ctrl] + [b] 『Up』 Move one page, equivalent to [Page Up] Buttons (commonly used)
: n1, n2s / word1 / word2 / g n1 and n2 are numbers. Find the word1 string between the n1 and n2 columns, and replace the string with word2!:
1, $ s / word1 / word2 / g Find the word1 string from the first row to the last column , and replace the word Replace the string with word2! (Common)
: set nu displays the line number, after setting, the line number of the column will be displayed at the beginning of each column
Find command:
/ + What you want to find is to search downward from the line where the cursor is located
? + What you want to find: to search upward from the line where the cursor is located
Keyword switching n Down switching N Up switching
#: The cursor moves to the word with the search first # number
Command mode switch to text editing mode
a: insert
A after the cursor : insert
i at the end of the line : insert
I before the cursor: insert at the beginning of the line
o: insert a blank line
under the cursor O: insert in the line above the cursor