This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11973|Reply: 0

[linux] Solution to the error after closing the vim editor abnormally

[Copy link]
Posted on 6/28/2018 1:32:12 PM | | | |
When using vim, the error generally occurs in the following two situations:

(1) When you edit the same file with multiple programs.

(2) When you withdraw from the program.

The following information is prompted:


E325: ATTENTION
Found a swap file by the name "/etc/systemd/system/.supervisor.service.swp"
          owned by: root   dated: Thu Jun 28 13:18:19 2018
         file name: /etc/systemd/system/supervisor.service
          modified: no
         user name: root   host name: VM_0_9_centos
        process ID: 13409 (still running)
While opening file "/etc/systemd/system/supervisor.service"

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r /etc/systemd/system/supervisor.service"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/etc/systemd/system/.supervisor.service.swp"
    to avoid this message.

Swap file "/etc/systemd/system/.supervisor.service.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:
(1) (2) The solution given by the official:

(1) To avoid two different versions of the same file, it is recommended to choose "(Q)uit" or continue to carefully modify the selection of "(E)dit anyway".

(2) You can also choose "(R)ecover" or "vim -r filename" to restore it to the unmodified state, and then delete the swp file (make sure your swp file is useless at this time).

What the bottom option means:

O: Only read, cannot be changed

E: Yes, the previous modifications are lost

R: Revert (previous modification)

D: Delete (delete the .swp file, restore the file to its original state)

Q: Exit

A: Give up

Specific solutions:

(1) If you don't want to keep the original modified content, just select D.

(2) If you want to keep the original modified content, select R to copy the modified content and save it, then exit the file and delete the awp file. (AWP files are hidden by default, view them with ls -a command, and delete them with rm commands.) )

The reason for this problem is that after the exception exits, Linux will generate a SWP file for this file, and the next edit will judge that if there is this file, it will still prompt, if you do not intend to restore the content of the old file, just delete this file, and the prompt will not appear again.
If you execute the ll command under the current directory, you will not see this file, you can directly execute the command:











Previous:Create an MVC project ASP.NET the Core command line
Next:Centos 7 .Net core background daemon supervisor tutorial
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com