Vim打不开文件:Another program may be editing the same file./An edit session for this file crashed.

2023-10-22 19:10

本文主要是介绍Vim打不开文件:Another program may be editing the same file./An edit session for this file crashed.,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Linux 下用 Vim 打开一个脚本文件“f03.sh”,直接报错:

vim f03.sh

遇到英文错误不要怕,先看一下报错的内容。

  • Another program may be editing the same file.
  • An edit session for this file crashed.
    在这里插入图片描述
E325: ATTENTION
Found a swap file by the name ".f03.sh.swp"owned by: geofferysun   dated: Wed Apr 28 14:28:12 2021file name: ~geofferysun/NDK/New/f03.shmodified: YESuser name: geofferysun   host name: LAPTOP-G599D37Hprocess ID: 139 (STILL RUNNING)
While opening file "f03.sh"dated: Wed Apr 28 15:59:15 2021NEWER than swap file!(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 samefile 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 f03.sh"to recover the changes (see ":help recovery").If you did this already, delete the swap file ".f03.sh.swp"to avoid this message.

解决思路: Linux 下两个人同时打开同一个文件会显示如下界面,而有的时候只有一个账户的时候也有这个提示,此时的处理思路是由于上次没有关闭打开的文件造成的,结束掉进程即可。

一、结束进程

  1. 查看 vi 进程
ps -ef | grep vi
geofferysun@LAPTOP-G599D37H:~/NDK/New$ ps -ef |grep vi
geoffer+   139     8  0 14:27 tty1     00:00:00 vim f03.sh
geoffer+   202     8  0 16:12 tty1     00:00:00 grep --color=auto vi

8个字段的含义:

UIDPIDPPIDCSTIMETTYTIMECMD
geoffer+1398014:27tty100:00:00vim f03.sh
geoffer+2028016:12tty100:00:00grep --color=auto vi
  • UID:程序被该 UID 所拥有
  • PID:就是这个程序的 ID
  • PPID:则是其上级父程序的ID
  • C:CPU使用的资源百分比
  • STIME:系统启动时间
  • TTY:登入者的终端机位置
  • TIME:使用掉的CPU时间。
  • CMD:所下达的是什么指令
  1. 结束掉指定(PID为139)进程
kill -9 139

如果结束进程后仍然有这个提示,此时是由于缓存造成的删除缓存即可。

二、清除上次操作留下的缓存

“f03.sh” 文件后面添加 “.swp”,可以 tab 键补齐出来

 rm -rf .f03.sh.swp

此时再打输入开文件指令即可恢复正常。

这篇关于Vim打不开文件:Another program may be editing the same file./An edit session for this file crashed.的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/263100

相关文章

Vim使用基础篇

本文内容大部分来自 vimtutor,自带的教程的总结。在终端输入vimtutor 即可进入教程。 先总结一下,然后再分别介绍正常模式,插入模式,和可视模式三种模式下的命令。 目录 看完以后的汇总 1.正常模式(Normal模式) 1.移动光标 2.删除 3.【:】输入符 4.撤销 5.替换 6.重复命令【. ; ,】 7.复制粘贴 8.缩进 2.插入模式 INSERT

问题-windows-VPN不正确关闭导致网页打不开

为什么会发生这类事情呢? 主要原因是关机之前vpn没有关掉导致的。 至于为什么没关掉vpn会导致网页打不开,我猜测是因为vpn建立的链接没被更改。 正确关掉vpn的时候,会把ip链接断掉,如果你不正确关掉,ip链接没有断掉,此时你vpn又是没启动的,没有域名解析,所以就打不开网站。 你可以在打不开网页的时候,把vpn打开,你会发现网络又可以登录了。 方法一 注意:方法一虽然方便,但是可能会有

Linux 下的Vim命令宝贝

vim 命令详解(转自:https://www.cnblogs.com/usergaojie/p/4583796.html) vi: Visual Interface 可视化接口 vim: VI iMproved VI增强版 全屏编辑器,模式化编辑器 vim模式: 编辑模式(命令模式)输入模式末行模式 模式转换: 编辑-->输入: i: 在当前光标所在字符的前面,转为输入模式

BD错误集锦5——java.nio.file.FileSystemException 客户端没有所需的特权

问题:在运行storm本地模式程序时,java.nio.file.FileSystemException  客户端没有所需的特权   解决方式:以管理员身份运行IDEA即可。

BD错误集锦1——[Hive]ERROR StatusLogger No log4j2 configuration file found. Using default configuration:

错误描述:在使用IDEA进行jdbc方式连接到hive数据仓库时,出现以下错误:                ERROR StatusLogger No log4j2 configuration file found. 问题原因:缺少log4j2.xml文件   <?xml version="1.0" encoding="UTF-8"?><Configuration><Appender

iOS:编译时出现no such file or directory:xxx以及use twice...filenames are used to distinguish private dec

简    注册  登录   添加关注 作者  婉卿容若 2016.04.29 11:22 写了21870字,被16人关注,获得了14个喜欢 iOS:编译时出现"no such file or directory:xxx"以及"use twice...filenames are used to distinguish private

laravel 多个项目共享SESSION

只讨论一个域下的项目。 eg: a.xxx.com 和 b.xxx.com 来共享session 如果多个laravel项目共享SESSION要满足以下条件: SESSION可以存放在一个地方,eg:共用一个reids用户表为连接同一个数据库的用户表需要在同一域下 操作步骤:以将session 存放到redis中为例: 1. 安装redis库composer require predis/

把Sublime Text 2 加入右键菜单(带图标), Edit with Sublime Text

Sublime Text 2 是现在很受大家欢迎的编辑器了,不仅是在web前端,在书定简单的php、Js等代码时,也是相当的好用,再配合多种的插件和新颖的界面,更是让人欲罢不能。 在使用时,我们通过喜欢打开一个文件的时候,右击再选择打开程序,比如会用记事本、Notedpad++之类的,这时如果把Sublime Text也加入到其中毕竟会方便不少,在找了一番后,实验成功,效果如下: 实现

vue dist文件打开index.html报Failed to load resource: net::ERR_FILE_NOT_FOUND

本地正常。打包好的dist文件打开index.html报Failed to load resource: net::ERR_FILE_NOT_FOUND 解决办法: 在webpack.prod.conf.js 中output添加参数publicPath:’./’ 在webpack.base.conf.js里 publicPath: process.env.NODE_ENV === ‘pro

github 报错 git fatal: unable to write new index file

错误一:git fatal: unable to write new index file主要原因就是服务器磁盘空间不够导致的,增加服务器空间就OK了在百度上面搜索没得到什么有效信息,在gooogle上搜索得到很多有效信息 Finding large directories with something like the following helped clean up some log fi