Vim File Operation command

Source: Internet
Author: User

is ready to exit vim without any editing processing You can use this command. vim does not allow users to use " :q "command exits with the following warning message:

no write since last change (: quit! overrides)

TD Width= "465" >

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

after saving the contents of the file, exit vim Editor. 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 . Span style= "Font-family:times New Roman;" >vim the editor. Another alternative is to use the zz command.

:wq!

forces the file contents to be saved and exits vim Editor. The purpose of this command is to force the data in the memory buffer to be written to the file specified at the start of vim , and then exit . Span style= "Font-family:times New Roman;" >vim the editor.

zz

use zz command, if the file has already been edited and processed, Writes the data in the memory buffer to the file specified when you start vim the editor. Otherwise, just exit zz command is preceded by a colon ":" and no need to press enter key.

:q

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

Vim File Operation command

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.