Vi editor is the original editor of Unix system, powerful and complete. However, the Vi editor is relatively complex and will encounter various troubles when using it. Therefore, the Vi editor is improved in The Linux system and the Vim editor is launched. Vim is a vi-like text editor that adds a lot of new features on the basis of Vi. It is recognized as one of the most useful viM-like editors
Vim is a text editor developed from Vi, which is rich in programming functions such as code completion, compilation and error jumping, which is equivalent to a notepad in Windows.
The three modes of Vim Editor in Linux mainly include command mode, input mode and bottom-line command mode. Their functions are as follows:
First, Command Mode
When you start the vim/vi editor, you enter command mode. In this state, the keyboard tapping action is recognized by VIM as a command rather than an input character, such as pressing i, which does not enter a character and I is treated as a command.
I switch to input mode to enter characters;
X Deletes the character where the current cursor is located;
: Switch to baseline command mode to enter commands on the bottom line.
If you want to edit the text, after starting VIM to enter command mode, press I and switch to input mode; Command mode only has some basic commands, so you still need to rely on the bottom line command mode to enter more commands.
Second, Input Mode
When the VIM editor is started, pressing I in command mode enters input mode, in which the following keys can be used:
Character keys and shift combinations to enter characters
ENTER, Enter key, Line change
BACK SPACE, backspace key, deletes the previous character of the cursor
DEL, Delete key, Delete a character after cursor
Direction key, move cursor in text
HOME/END, move cursor to the beginning or end of a line
Page Up/Page Down, page up/down
Insert, toggle the cursor to input/replace mode and the cursor will become vertical/underlined
ESC, exit input mode, switch to command mode
Third, Bottom Line Command Mode
Press in Command Mode: Enter Bottom Command Mode (English colon).
The bottom line command mode allows you to enter commands with one or more characters, and there are many commands available.
In the bottom line command mode, the basic commands are:
Q Exit Procedure
: W Save Files
: WQ Save File and Exit Program
Press ESC to exit bottom line command mode at any time