Vim Command Detailed

Source: Internet
Author: User

Command

Simple description

: W

Saves the edited file content, but does not exit the Vim editor. The purpose of this command is to write the data in the memory buffer into the file specified when Vim is started.

: w!

Force the file to be written, that is, to overwrite the original file. This command can be used to force writes if the original file's access permission does not allow writing to the file, for example, if the original file is a read-only file. However, this command usage applies only if the user is the owner of the file, and the superuser is not restricted.

: Wq

Exit the VIM editor after saving the contents of the file. The purpose of this command is to write the data in the memory buffer to the file specified when you start Vim, and then exit the Vim editor. Another alternative approach is to use the ZZ command.

: wq!

Forces the file contents to be saved and exits the Vim editor. The purpose of this command is to force the data in the memory buffer to be written to the file specified when Vim is started, and then exit the Vim editor.

Zz

When using the ZZ command, if the file has already been edited, write the data in the memory buffer to the file specified when you started vim and exit the Vim editor. Otherwise just quit Vim. Note that you do not need to precede the ZZ command with a colon ":" or press the ENTER key.

: Q

You can use this command when you are ready to exit VIM without any editing processing. If edit processing has been done, VIM does not allow the user to exit with the ": Q" command, and also outputs the following warning message:

No write since last change (: quit! overrides)

: q!

Forces the VIM editor to quit and discard the results of the editing process. If you do not need to save the modified file content, you can enter ": q!" command to forcibly exit the Vim editor.

: w filename

Writes the result of the edit process to the specified file and saves it

: w! FileName

The result of editing is forced to be saved to the specified file, overwriting the existing file if the file already exists.

: wq! FileName

Forces the edited result to be saved to the specified file, overwriting the existing file if the file already exists, and exiting the Vim editor.

Description: W is the write abbreviation, that is, the meaning of writing, q is the quit abbreviation, that is, the meaning of exit! Represents coercion.

Vim Command Detailed

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.