VI is a command-line interface under the text Editing tool, Vim is an enhanced version of VI.
Vim or VI commands can start the VIM editor
Vim + Destination file path Open file with vim
If the destination file exists, Vim opens the file
If the destination file does not exist, VIM creates the new file and opens the
VI of the three types of models:
1. Command mode (normal mode)
Pressing the ESC key in any mode will return command mode. In command mode, you can select, copy, paste, undo, and so on by typing different commands.
2. Insert mode
Press "i" in command mode to enter insert mode, you can enter edit text content in insert mode, and press ESC to return to command mode.
3, ex Mode
Press the ":" Key in command mode to enter ex mode, in ex mode to save, modify, and exit Vim.
Command mode:
I insert text before the cursor
o Insert a new row below the current line
DD Deletes entire row
YY put the contents of the current row into a buffer (copy the current row)
P Put the contents of the buffer behind the cursor (paste)
Number yy copy n rows
R replaces the current character (press R first, then press the new character to replace)
U Undo Last Action
/keyword Lookup keyword (press n key to switch back and forth between these keywords found)
Ex mode:
W Save current changes
Q exit
Q. Force exit, do not save any changes
Wq first Save and then exit
X Save and exit
Set Nu/set number shows line numbers
。 System command executes a system command and displays the result
SH switch to the command line, and then press CTRL + D to return to vim