vi编辑器下出现E325:ATTENTION的解决办法

如果vi打开一个文件,但又去做其他事而不及时把它关掉,等再回来处理时,ESC键已经失效,这时可以按Ctrl+z强制退出(或者直接关闭终端窗口)。但再次用vi打开此文件时,就会出现以下内容:

E325: ATTENTION
Found a swap file by the name “.Makefile.swp”
owned by: yuanyuanchen dated: Mon May 24 15:10:26 2021
file name: ~yuanyuanchen/Documents/BinaryAsteroid/asteroid_binary-main/myexamples/bin2/Makefile
modified: no
user name: yuanyuanchen host name: Yuanyuans-MacBook-Pro.local
process ID: 4180 (still running)
While opening file “Makefile”
dated: Mon May 24 14:31:58 2021

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

Swap file “.Makefile.swp” already exists!
[O]pen Read-Only, (E)dit anyway, ®ecover, (Q)uit, (A)bort:

这时可以按E进入文件正常编辑。但以后每次vi打开此文件时都会有这一步,是不是很烦???

怎么再恢复正常的vi打开方式呢?到底发生了什么?

其实上面这堆英文里已经给出答案啦~~

因为在强制退出后,有个隐形文件.Makefile.swp被创建(这里的Makefile对应刚才vi打开的文件名,可能是其他的名字),所以只要删除.Makefile.swp就可以了!

返回含这个文件的目录,输入rm .Makefile.swp即可。这里的Makefile要改成你自己的文件名。

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值