Common Operations in the Vim Editor
Press I to enter the editing mode
Wq! Force save and exit
Q! Do not save, force exit
! Mandatory
Direction key bit:
K
H j l
Ctrl + f move down one page
Ctrl + B move one page up
Starting with a line 0
$ End of a row
The last line of the G File
The first line of the gg File
Dd deletes the row where the cursor is located.
Yy copies the same cursor
P pasted copy content
U rollback ctrl + r forward both are a pair of operations
. Decimal point ".", repeat an operation
[Esc] exit the editing mode, Shift +; enter the command line mode
Ctrl + v block selection, the selected area will be reversed
Y: copy the reversed content.
D. Delete the reversed content.
Multi-file editing
You can add a file name after sp. If you need to open the file, enter the file name. If you only enter sp, the same file will be in two windows.
Ctrl + w + j/k move between windows
Ctrl + w + q exit the current window
The vim setting value is in the/etc/vimrc file, which is not recommended to be modified. Can be modified ~ /. Vimrc (the default does not exist. You can manually create it if necessary)
Vim garbled, as long as it is a coding problem
Echo $ LANG view Encoding
LANG = zh_CN.UTF-8 set encoding
Iconv command can be used to convert language codes