Linux system knowledge 3—VI\VIM editor, vi\vim editor's three working modes, command mode (Command mode), input mode (Insert mode), bottom line command mode Last line

1.VI\VIM editor

1..vi \ vim editor introduction

vi \vim is the abbreviation of visual interface and is the most classic text editor in Linux
Like the text editor in the graphical interface, vi is the text editor under the command line Excellent choice for editing files.
 vim is an enhanced version of vi. It is compatible with all instructions of vi. It can not only edit text, but also has the function of shell program editing. You can use different colored fonts to identify the correctness of the grammar, which is great. Convenient program design and editing.

2. Three working modes of vi \ vim editor

1. Command mode (Command mode)

In command mode, the editor understands the keys you press as commands and executes different functions driven by commands. Under this model, text editing is not freely possible.

If you need to edit files through vi / vim editor, please use the following command:

 vi file path
 vim file path

vim is compatible with all vi functions, and all subsequent vim commands will be used
If the file represented by the file path does not exist, then this command will be used to edit the new file

If the file represented by the file path exists, then this command is used to edit the existing file.

2.Insert mode

is the so-called edit mode and insert mode.
In this mode, you can freely edit the file content.

3. Bottom line command mode (Last line mode)

Starting with:, it is usually used for saving and exiting files.

There is nothing special about the editing mode. After entering the editing mode, any shortcut keys have no effect, just input text normally. The only thing you need to remember is:You can return to the command mode through esc.
In the command mode, enter  : to enter the bottom line command mode, which supports the following commands:

4. Command mode shortcut keys

After the quick experience just now, students must have a certain understanding of switching between the three modes. Now let's take a look at some common shortcut keys in command mode.

model Order describe

command mode

i Enter input mode at the current cursor position
command mode a Enter input mode after current cursor position
command mode I At the beginning of the current line, enter input mode
command mode A At the end of the current line, enter input mode
command mode O Enter input mode on the line below the current cursor
command mode 0 Enter input mode on the line above the current cursor
input mode esc In any case, enter esc to return to command mode

Guess you like

Origin blog.csdn.net/WZY22502701/article/details/132767239