Linux (5) -- VI/VIM Editor, -- vivim
After all, we can't do without editing files. In Linux, we usually use VI/VIM to edit files. VI is a text editor that comes with Linux. VIM is an enhanced version of VI. Some release versions may not come with it. You can use the sudo apt-get install vim command to install vim.
You can use the vi or vim command to directly enter a new text file, or use the vim file name to open the file for editing.
The interface is different from the command line interface:
At this time, you may not be very sensitive to input, because there are three modes in vi. Only the insert mode can be inserted and deleted as you would in the windows text editor. The three modes are described as follows:
1-command mode (default mode. In any form, pressing esc enters the command mode. In this mode, only commands are received. In this mode, you can select, copy, paste, undo, and other traditional operations. 2-insert mode (can be output freely) press the I key in command mode to enter insert mode. In this mode, you can enter and edit the text content. 3-in operating command mode such as saving and exiting files in ex mode, press: to enter (shift + may be required) in addition to entering and editing in the insert mode, the other two modes also have corresponding command operations: Common commands in the command mode: I insert text before the cursor o Insert a new line dd under the current row Delete the current row yy put the content of the current row into the buffer (copy the current row) n + yy copy n rows of content p paste the cached text to the cursor u undo the previous operation r replace the current character/key search keyword (key) then press the n key to switch the key word EX mode. Common command: w to save the current modification: q to exit: q! Force exit, do not save changes: x save and exit, equivalent to: wq: set number display row number :! Execute a system command and display the result: sh switches to the command line, and press ctrl + d to switch back to vi.