1) command-line mode: The typed content is interpreted as a command.
2) Insert mode: The type of content is inserted into the file.
3) Visual mode: Select, cut, and copy text from the keyboard.
4) Ex mode: Use more commands (for example: storing files, replacing text, etc.).
When the blogger first touches vim, it also tries to use it like any other editor, that is, to go into the insert mode and do the clumsy work. In fact, the true power and speed of vim lies in its command-line mode. After a true mastery of vim, it is found that the use of insertion mode is less time and more prone to use convenient command-line mode.
First, about turn off and mode switch
You can start vim with the following command:
$ vim Test.txt
The document is then opened, but cannot be edited, and Vim is in command-line mode. You can use the keyboard to perform VIM commands in this mode.
To insert text, position the cursor to the insertion position (the following sections describe the efficient cursor positioning method), and then press I to enter insert mode.
Press ESC to return to the command-line mode.
After editing, enter: Wq and return can save exit, or: q! can not save exit.
In the command-line mode, there are some notable areas:
1): E <path/to/file>→ Open a file
2): w→ disk
3): SaveAs <path/to/file>→ Save As <path/to/file>
4): X, ZZ or: wq→ Save and exit (: X means save only when needed, ZZ does not need to enter a colon and return)
5): q! → Exit does not save: qa! Forcibly exits all files being edited, even if other files have changed.
6): bn and: bp→ When you open many files at the same time, you can toggle the next or previous file with these two commands.
Vim uses advanced