美文网首页
vim编辑文件出错 swap file “*.swp”alrea

vim编辑文件出错 swap file “*.swp”alrea

作者: 伟_4649 | 来源:发表于2020-04-03 09:22 被阅读0次

在linux中使用vim编辑文件时,很常见的一个问题,若没有正确定的退出编辑,系统会生成一个隐藏文件.**.swp,此时若再次进入编辑,都会提示错误If you did this already, delete the swap file ".**.swp",若要想再次正确编辑文件,必须先删除.**.swp文件。
错误信息如下:

E325: ATTENTION
Found a swap file by the name ".11-1.c.swp"
          owned by: fairy   dated: Tue Dec 18 19:44:18 2018
         file name: ~fairy/Unix_Code/Chapter11/queue_2.0/11-1.c
          modified: no
         user name: fairy   host name: ubuntu
        process ID: 2239 (still running)
While opening file "11-1.c"
             dated: Tue Dec 18 16:48:41 2018

(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 11-1.c"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".11-1.c.swp"
    to avoid this message.

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

解决办法,切换到编辑文件所在的目录,执行:

rm .**.swp 

VIM中解决swap file “*.swp”already exists!文件已打开

相关文章

网友评论

      本文标题:vim编辑文件出错 swap file “*.swp”alrea

      本文链接:https://www.haomeiwen.com/subject/iumcphtx.html