什么是.swp 文件以及为什么要创建它们?

什么是.swp 文件以及为什么要创建它们?

我有一个名为的目录,/home/Prog用于存放程序。有时,.swp此文件夹中会创建一个带有扩展名的隐藏文件,其内容看起来像我在此文件夹中拥有的程序。

ls -a /home/Prog 
.  ..  1  1.c  2  2.c  3  3.c  4  4.c  .4.c.swp

结果cat .4.c.swp是:

U3210#"! Utp5ad�mehrMehr-hp~mehr/Prog/4.cutf-8
�5��������n[Z5"�������g('�
       ~
        }
         [
          #

                 }return 0;            else        printf("UNEQUAL\n");                               }                          printf("EQUAL\n");                                           {                       }                                   if(x[i]==y[j])                   {for(i=0;x[i]!='\0';i++)printf("------------------------------------------------\n");//cat two strings without lib;/*********************************************************/                printf("second str after copying: %s\n", y);                 }                y[i]=x[i];                 {for(i=0;x[i]!='\0';i++)/************************************************************/printf("second str has %d cars\n", j);while(y[j]!='\0'){j++;}j=0;/**********************************************************/printf("%d\n",i); {i++;}while(x[i]!='\0')i=0;   */fgets(y,30,stdin);printf("Enter the second string\n");fgets(x,30,stdin);printf("Enter the first string\n");/*int i,j;char y[30]="Mme Rusta";char x[30]="I    do";{int main()#include<string.h>#include<

当我想创建一个名为4.cvim 的新文件时,我收到以下消息:

E325: ATTENTION
Found a swap file by the name ".4.c.swp"
          owned by: mehr   dated: Fri Nov 27 16:52:36 2020
         file name: ~mehr/Prog/4.c
          modified: YES
         user name: mehr   host name: Mehr-hp
        process ID: 1859
While opening file "4.c"
      CANNOT BE FOUND
(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 4.c"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".4.c.swp"
    to avoid this message.

Swap file ".4.c.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, 
(A)bort: 

这个文件是什么.swp以及为什么要创建它?

相关内容