How to get out of the VIM editor in a Linux system, methods and differences

Source: Internet
Author: User

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

    • Linux System Vim Editor

Go to the VIM editor

    1. 1

Vim Editor, you can create a new file or modify a file, the command is: vim/usr/local/con.cfg

    1. 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.

    1. 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

    1. 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!
    2. 1, first introduce save exit. When we edit or modify the contents of the file,.
    1. 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.
    1. 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.

    1. We can use the View command: Cat to view its contents: cat/usr/local/con.cfg,.
    1. 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,

    1. 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.

    1. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.