The common use of VI
1. General mode
Ctrl+f Move Down one page
Ctrl+b Move up one page
Ctrl+d Move Down half a page
Ctrl+u move up half a page
N[enter] cursor down n line, n for number, Enter for key
NG moves to the nth row of the file
G move to the last line of the file
DD Delete the line that the cursor is on
NDD Delete the n rows under the cursor
YY Copy the line selected by the cursor
P,p Paste the copied line
YG copies the contents of the cursor to the last line
NYY copy cursor down n rows
X Remove one character backwards
NX removes n characters backwards
DD Delete the line where the cursor is located
NDD Delete the n rows under the cursor
20,50S/MAN/MAN/GC the man from 20 to 50 rows into man (replace with man (y/n/a/q/l/^e/^y)? Indicates whether to change the question)
2. Edit mode
I enter insert mode
Save and leave the command
: Set NU Displays line numbers in front
: Set Nonu cancels the line number shown earlier
: Wq Exit Edit
: w [FileName] writes edited data to another file
: R [FileName] reads another file into the back appended
: n1,n2 w [filename] reads files n1 to N2 into another file
: q! Leave no storage
The basic use of VIM