Vim save File ": Wq" and ": X" Difference

Source: Internet
Author: User
Tags save file

Vim is one of the most commonly used editors of the unix/linux system, and when I save a file, I usually choose ": Wq", because when I first learned vim, I only remembered a few commonly used commands, and there was no meaning of the scrutiny command.

However, when I compiled the code recently, I found that, without modifying the source file, only the ": Wq" command is used to save the file, the source file will be recompiled. This is because, even if the file is not modified, ": Wq" forces the update of the file's modification time so that make compiles the entire project to assume that the file has been modified, and then recompile the chain to deliver the executable file. This can have misleading consequences and, of course, unnecessary system resource costs.

The real difference between ": X" and ": Wq" is as follows:
: Wq mandatory write file and exit. Force write even if the file is not modified, and update the file's modification time.
: X writes the file and exits. The file modification time is not updated unless the file is modified and the file modification time is updated.

Vim save File ": Wq" and ": X" Difference

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.