首页 > 解决方案 > 没有删除选项来删除 .bash_profile.swp

问题描述

我正在编辑一个 .bash_profile 文件,然后我不小心关闭了 bash 控制台。从那时起,每当我尝试使用 vim 打开 .bash_profile 时,都会收到 E325: Attention 错误。

我遇到了一个与此类似的问题,并且有一个答案,据说在给出的选项中选择 (D)elete。但我没有看到那个选项。

While opening file "/Users/hareentej22/.bash_profile"
             dated: Fri May 18 02:20:07 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 /Users/hareentej22/.bash_prof
ile"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/Users/hareentej22/.bash_prof
ile.swp"
    to avoid this message.

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

有没有其他方法可以解决这个问题?

标签: vim

解决方案


删除选项显示在较新版本的 vim 中,但即使较新版本有时也不会显示该选项。我不知道它在什么条件下显示。

我认为\rm ~/.bash_profile.swp是这里最好的方式


推荐阅读