An. swp file is generated when the VI editor is not properly closed

Source: Internet
Author: User

An abnormal shutdown of the VI editor will generate a. swp file about SWP file Use VI, often can see SWP this file, that this file is how to produce it, when you open a file, VI will generate such a. (filename) SWP file for contingency (rainy below discussion), if you exit normally, then this SWP file will be automatically deleted. The following said that the accident.          Accidents are divided into: 1 when you use multiple programs to edit the same file. 2 non-regular exits. In the first case, to avoid having two different versions of the same file (the exact words in vim), it is advisable to choose ReadOnly. In the second case, you can use vim-r filename to restore, and then delete the SWP file (this time to ensure that your SWP file is useless, or you will be sad)

SWP file History, when you forcibly shut down VI, such as power suddenly broke off or you use the CTRL+ZZ,VI automatically generate a. swp file, the next time you edit, there will be some prompts.

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 prompt for each edit.

Rm. {Your file name}.swp

A similar hint was found on the web, and different Linux hints might 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 the R key to recover.

VI Editor to exit normally, you can use Shift-zz.

[SuSE] The Resolved VI command generates a. swp file-related issues-> example: A. a.dat.swp file is generated when using VI a.dat
       then open a terminal VI A.D At is prompted:
       "Swap file". FileName. SWP "Already exists![ O]pen read-only, (E) dit anyway, (R) Ecover, (Q) uit: "  

-> VI version:
   vi-vierson
     VIM-VI Improved 6.3 (June 7, compiled Oct 23:12:36)
       ;  
->   asks: (vi a file how can not let it produce. swp file.
          or don't let him hint "Swap file". FileName. SWP "Already exists! [O]pen read-only, (E) dit anyway, (R) Ecover, (Q) uit: ")

Processing method: Open/ETC/VIMRC and add set Noswapfile after OK

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.