为什么vim不能总是让我选择删除交换文件?


17

如果崩溃后重新启动vim,它会告诉我存在我文件的交换文件,并问我该怎么做-无论如何打开,恢复文件,退出,中止等等。有时,它为我提供了选择删除交换文件,通常这是我需要的选项。但是其他时候,由于某种原因,它没有给我这种选择。为什么会这样,如何获得vim以便允许我从vim中删除交换文件?(因为手动删除它很麻烦。)

Answers:


20

来自:help swap-exists

D  Delete the swap file.  Use this when you are sure you no longer need it.
   For example, when it doesn't contain changes, or when the file itself is
   newer than the swap file.
      On Unix this choice is only offered when the process that created the
   swap file does not appear to be running.

因此,听起来好像Vim以某种方式相信另一个Vim进程仍在该文件上积极运行。


3
太好了 现在我看到,当我的SSH连接断开时,vim进程仍然在后台存在。
乔纳森(Jonathan)

为+1 :help swap-exists。我总是对选择感到困惑。
wisbucky

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.