Course connection: Vi text editor vi and vim introduction vi is a text editing tool on the command line interface. it has functions such as text editing, text processing, and code development.
Course connection: Vi text editor
Vi and vim
Vi is a text editing tool on the command line interface. It provides text editing, text processing, code development, and other functions.
Vim is from vi ?? Strong edition (code highlighting)
Run vim to start the vim editor.
Vim + target path
If the file exists, open the file. if the file does not exist, create the file.
Vim three modes-command mode
After vim is started, it enters the command mode by default. in any mode, the command mode can be returned through the esc key. In command mode, you can copy, paste, select, and revoke commands.
-In the insert mode, press 'I in the command mode to enter the insert mode. in the insert mode, you can enter the edit content and press esc to return to the command mode.
-In the command mode, press the ':' key in the quiet mode. the cursor moves to the bottom. you can save or exit vim here.
Command mode
I insert o in front of the cursor insert dd in the next row of the current row delete the current row yy put the current row into the buffer (copy the current row) n + yy put n lines of content into the buffer (copy the current n rows) p paste the content in the buffer after the cursor u undo r replace the current character/search keyword (n key switch)
EX Mode: w save: q exit: q! Force exit, do not save changes: x save and exit, equivalent to: wq: set number display row number :! The system command executes a system command and displays the result: sh switches to the command line, Ctrl + d returns vim
Insert mode
After pressing 'I', you can enter any text, and esc will exit the return command mode.