About VI abnormal exit resulting from the SWP file

Source: Internet
Author: User

 about VI Abnormal exit resulting from the SWP file 

An. swp file is generated when you close the VI editor abnormally

About SWP file using VI, you can often see SWP this file, then how this file is generated, when you open a file, VI will generate such a. (filename) SWP file for contingency (discussed below), if you exit normally, then this SWP file will be automatically deleted. Here's the accident.         Contingency is divided into: 1 when you use multiple programs to edit the same file. 2 non-regular exit. In the first case, in order to avoid producing two different versions of the same file (the exact words in vim), it is advisable to choose ReadOnly as well. In the second case, you can use vim-r filename to recover, and then delete the SWP file (this time to make sure your SWP file is useless, otherwise you will be sad)

The origin of the SWP file, when you forcibly close the VI, such as power suddenly broken or you use the CTRL+ZZ,VI automatically generated a. swp file, the next time you edit, there will be some hints.

You can use

Vi-r {your file name}

To recover the file, and then delete the SWP file with the following command, or you will always have this hint every time you edit it.

Rm. {Your file name}.swp

Found a similar hint on the Internet, different Linux hints may not be the same

". Xorg.conf.swp" Already exists!
[O]pen read-only, (E) dit anyway, (R) Ecover, (Q) Uit:

Of course you can use R key to recover.

VI Editor to exit normally you can use SHIFT-ZZ.

If you do not want to save the SWP file every time vi crashes, you can modify the file

About VI abnormal exit resulting from the SWP file

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.