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

Source: Internet
Author: User

In Linux, the Vim editor is the system's own text editor, which is powerful. This vim (VI) is very simple. Note: Linux commands are lowercase!
Vim Editor, you can create a new file can also modify the file, the command is: vim/usr/local/con.cfg If this file is not previously, then for new, enter the command click on the button below the prompt for the new file. If the file already exists, there is no prompt. After entering the editor, 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. Methods and differences for exiting the VIM editor when the text edits are finished, you need to exit the editor. Exit Editor is divided into 4 cases: Save exit, normal exit, do not save exit and force quit.
1. Save and exit. Edit or modify the contents of the file, to save and exit, at this point, we want to press "ESC" in the upper left corner of the keyboard, then we enter "Colon", that is ":" (do not need double quotes), there will be a colon, wait for the input command, and then enter Wq.
W:write, writing
Q:quit, exit
Then return to the store and exit.
Save the second method of exiting:
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, 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!" as you enter the command.
4, forced to quit. This is an action that should not be done and is not recommended. Press ESC first, then the colon, and enter "!" directly when you enter the command. After forced exit, there will be a prompt!

Note: The essay content is from the online data collation, for reference only.

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.