为什么 vim 不总是给我删除交换文件的选项?

Jon*_*han 24 vim

如果我在崩溃后重新启动 vim,它会告诉我我的文件的交换文件存在,并询问我该怎么做——无论如何打开、恢复文件、退出、中止等。有时它让我选择删除交换文件,这通常是我需要的选项。但是,其他时候,由于某种原因,它没有给我那个选项。为什么会这样,我怎样才能让 vim 允许我从 vim 中删除交换文件?(因为手动删除它很痛苦。)

Hep*_*ite 26

来自: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.
Run Code Online (Sandbox Code Playgroud)

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

  • 哦酷。我现在看到当我的 SSH 连接丢失时,vim 进程仍然在后台以某种方式存在。 (4认同)