Vim is a reinforced version of VI, it is recommended to use VIM.
Vim has three different modes:
Command mode (normal mode)
After Vim starts, it enters command mode by default, and any mode can be returned to command mode by ESC. Command mode can be done by typing different commands to complete the selection, copy, paste, undo and so on.
Insert Mode
Type the i key in the command mode to enter insert mode, edit the text content in insert mode, and use ESC to return to command mode.
ex Mode
Type in command mode: You can enter the EX mode and the cursor will move to the bottom, where you can save the changes or exit vim.
Command mode common commands
I insert text before the cursor
o Insert a new row below the current line
DD Delete entire row
YY puts the contents of the current row into a buffer
N+yy the contents of n rows into a buffer
P Paste the text of the buffer into the cursor
U Undo Previous Action
R replaces the current character
/Find Keywords
n switches back and forth between keywords after a keyword is found
ex mode Command
: W Save current changes
: Q exit
: q! Forced exit
: x save and exit, equivalent to: Wq
: Set number Displays line numbers
: SH switch to command line, use Ctrl+d to switch back to vim
Linux vi vim text editor