Vi filename (File Name) --- enter Command Line Mode
If you enter Esc in the insert mode, the current mode is transferred to the command line mode.
Vi command line mode function key:
I --- switch to insert mode. The cursor is at the beginning of the input file.
A --- switch to the insert mode and enter text from the next position where the cursor is currently located
O --- switch to the insert mode and Insert a new row from the beginning of the row
Ctrl + B --- turn the screen back to a page
Ctrl + l --- move the screen one page forward
Ctrl + u --- half page flip
Ctrl + d --- half page flip
0 --- move the cursor to the beginning of the line
G --- move the cursor to the end of the article
NG --- move the cursor to line n
$ --- Move to the end of the row where the cursor is located
N <Enter> --- move the cursor down n rows
/Name --- Search for a string named name after the cursor
? Name --- Search for a string named name before the cursor
X --- delete a character behind the cursor position
X --- delete a character before the cursor position
Dd --- Delete the row where the cursor is located
Ndd --- Delete n rows from the row where the cursor is located
Yy --- copy the row where the cursor is located
Nyy --- copy down n rows starting from the row where the cursor is located
P --- paste the characters in the buffer to the cursor position
U --- restore the previous action
Function keys in bottom-line mode of Vi:
: W --- save the edited file to the disk
: Q --- exit Vi (the system will prompt the files that have been modified)
: Q! --- Force exit Vi (do not save modified files)
: Wq --- log out after saving the disk
: W [filename] --- save another file named filename
: Set nu --- display the row number
: Set nonu --- cancel row number display