In the Linux family, the Vim editor is the system's own text editor, which is powerful and self-contained.
I have small white, just contact with Linux, to modify a text file, it is not possible to operate like windows, and, worse, into the VI editor, can not exit so that the strong draw off the machine, it is not allowed to AH.
In fact, this vim (VI) is also very simple, as long as you see this article!
Note: The Linux command should be lowercase oh!
Tools/Materials
Go to the VIM editor
- 1
Vim Editor, you can create a new file or modify a file, the command is: vim/usr/local/con.cfg
!
- 2
If this file is not previously available, then for new, there is a hint for the newer file below.
If the file already exists, there is no prompt.
- 3
After entering the editor, we first press "I", that is, switch to the "insert" state. You can move the cursor up or down, or space, backspace, and enter to edit the content, and Windows is the same.
END
Ways and differences to exit the VIM editor
- When text editing is finished, you usually need to exit the editor. Exit Editor is divided into 4 cases: Save exit, normal exit, do not save exit and force quit. Let's just say the following!
- 1, first introduce save exit. When we edit or modify the contents of the file,.
- Of course we have to save and exit, and then the next step. At this point, we have to press the "ESC" in the upper left corner of the keyboard to notice it? The insertion state in the lower left corner is missing.
- Then we enter "colon", i.e. ":" (no double quotes), there will be a colon below, waiting for the input command, and I am typing Wq. Features are as follows.
W:write, writing
Q:quit, exit
Then return to the store and exit.
In fact, there are two ways to save an exit:
A: In the last input command, the direct input "X", is also the same, that is, X=wq.
B: The quickest way: After pressing ESC, press SHIFT+ZZ directly, or switch to uppercase mode by ZZ, you can save the exit, that is, by 2 uppercase Z.
- We can use the View command: Cat to view its contents: cat/usr/local/con.cfg,.
- 2, again normal exit, the normal exit has a precondition is: Open text file in the content has not been changed.
Press ESC and then enter a colon, enter "Q" When you enter the command,
- 3, to see not save the method of exit, many times opened the file, or modified some places, only to find the wrong, very need not to save the exit.
Press ESC, enter a colon, and enter "q!" directly when you enter the command.
- 4, forced to quit. This is really not supposed to do the operation, because very fucked!
Press ESC, then the colon, and enter "!" directly when you enter the command.
But after exiting, there will be a hint!
How to get out of the VIM editor in a Linux system, methods and differences