How to Exit Vim

Source: Internet
Author: User

How to Exit Vim

Learn a few patterns first:

General mode: Press the ESC key

Command-line mode: First cut to normal mode, then press SHIFT key and then enter ":"

Insert mode: Press A or I in general mode

Seven Ways to Exit

1, command line mode, enter "Q" after the return. This is a normal exit, only if the file has not been modified or the modification has been saved under the circumstances can be successfully exited, otherwise you will be prompted to change has not been saved and cannot exit.

2, command line mode, enter "q!" Back to enter. This is a forced exit and when a file has been modified and has not been saved, forcing the exit discards the modification.

3, command line mode, enter "Wq" after the return. This belongs to the first save and exit, only if the open file can be written and have edit permission to exit successfully, otherwise you will be prompted insufficient permissions or file read-only warning.

4, command line mode, enter "wq!" Back to enter. This is mandatory to save and exit, only if you have edit permission on the open file can exit successfully, otherwise you will be prompted insufficient permissions and other warnings. Read-only files with access rights can be successfully saved and exited even if they have been modified.

6, the general mode, enter "ZZ". This belongs to the first save after exiting, with "Wq".

7, General mode, enter "ZQ". This belongs to the forced exit, with "q!".

How to Exit Vim

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.