Vim in CentOS, centosvim
Install yum install-y vim-enhanced
Move cursor
H or the arrow key to the left: move the cursor to the left.
L or the right direction key: move the cursor one character to the right
J or downward direction key: move the cursor down a character
K or the upward direction key: move the cursor up a character
Ctrl + B: one page forward of the text page
Ctrl + F: The text page is displayed.
Number 0 or shift + 6: Move to the beginning of the row
Shift + 4: Move to the end of the row
Gg: Move to the first line
G: Move to the end of the row
NG (n is an arbitrary number): Move to row n
Delete, copy, and paste
X: delete backward
X: Forward Deletion
Nx: deletes n characters from the backend.
Dd: delete/cut the row where the cursor is located
Ndd: delete or cut n rows after the row where the cursor is located
Yy: copy the row where the cursor is located
P: paste the copied or pasted content from the row where the cursor is located.
P: paste the copied or pasted content from the row where the cursor is located.
Nyy: Copy n rows down from the row where the cursor is located
U: Restore the previous operation
V: After you press v, move the cursor to select the specified character, and then copy, paste, and so on.
Enter edit mode
I: insert it before the current character
I: insert at the beginning of the row where the cursor is located
A: insert it after the current character
A: insert behavior in the row where the cursor is located
O: Insert a new row into the next row of the current row.
O: Insert a new row into the previous row of the current row.
Other functions
: W save text
: Q: Exit Vim.
: W! Force save. In the root user, instant text can be saved only.
: Q! Force exit. All changes do not take effect
: Wq save and exit
: Set nu display row number
: Set nonu does not display row numbers