• 欢迎访问显哥博客,本网站纯属学习技术,绝无商业用途,欢迎小伙伴们共同学习!研究技术!QQ:52249909 加我QQ
  • 世界75亿人,这么小的概率,能认识你,是我一生的幸运,不妨加个QQ接触一下:52249909 加我QQ

Vim的执行过程及故障解决【显哥出品,必为精品】

运维基础 lixian 4年前 (2019-12-11) 971次浏览 1个评论 扫描二维码
文章目录[隐藏]

Vim的执行过程

1、当vim打开一个文件时会在当前目录下生成一个以 点swp为结尾的隐藏文件(修改文件其实就是修改了隐藏文件)
2、打开文件进入命令模式然后到末行模式进行退出
3、系统会根据是否改变了文件内容,如果改变了文件,隐藏文件会覆盖源文件,删除隐藏文件,如果没有改变,会直接删除隐藏文件。

Vim的执行故障

当用vim打开一个文件时,会出现以下报错:

E325: ATTENTION
Found a swap file by the name ".passwd.swp"
          owned by: root   dated: Wed Dec 11 19:45:20 2019
         file name: ~root/passwd
          modified: no
         user name: root   host name: qls
        process ID: 68044 (still running)
While opening file "passwd"
             dated: Wed Dec 11 18:32:03 2019

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

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

原因:
1、有人正在编辑这个文件
2、非正常退出导致的

排除:
1、先确定有没有人正在编辑这个文件
2、vim -r 打开这个文件,恢复之前没有保存的状态,然后保存退出,之后再执行rm -rf 删除隐藏的临时文件就OK了。


本站博主 , 版权所有丨如未注明 , 均为原创
转载请注明原文链接:Vim的执行过程及故障解决【显哥出品,必为精品】
喜欢 (24)

您必须 登录 才能发表评论!

(1)个小伙伴在吐槽
  1. :mrgreen: 加油
    匿名2019-12-11 23:35