vim Another program may be editing the same file.
来源:互联网 发布:淘宝卖家人工客服 编辑:程序博客网 时间:2024/05/29 13:39
使用vim进行编辑文件的时候,机器卡死了。然后开机重启,再次进行vim编辑的时候,总是不能保存,提示“readonly”。当时查看了文件权限,发现文件是可以读写操作的。当时就有点迷糊,后来再次进行编辑的时候注意到在编辑之前提示:Another program may be editing the same file,才想起来可能上次卡死之后,存在临时文件.swp文件,然后将.swp删除,就可以继续进行编辑了。下面是参考的博客(http://www.zongguofeng.cn/2010/0526/309.html)。
linux下两个人同时打开同一个文件会显示如下界面,而有的时候只有一个账户的时候也有这个提示,此时的处理思路是:由于上次没有关闭打开的文件造成的,结束掉进程即可
如两个用户同时打开:vi install.log 会有一个用户有此提示
E325: ATTENTION
Found a swap file by the name ".install.log.swp"
owned by: root dated: Sat May 1 10:52:16 2010
file name: ~root/install.log
modified: no
user name: root host name: localhost.localdomain
process ID: 14389 (still running)
While opening file "install.log"
dated: Sat Jan 30 21:31:27 2010
(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 install.log"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file ".install.log.swp"
to avoid this message.
"install.log" 892L, 33018C
Press ENTER or type command to continue
处理步骤
一、结束进程
[root@localhost ~]# ps -ef |grep vi
root 7177 7156 0 Apr29 tty7 00:00:00 /usr/bin/whiptail --yesno Failed to start the X server (your graphical interface). It is likely that it is not set up
correctly. Would you like to view the X server output to diagnose the problem? 10 50
root 25200 23993 0 22:54 pts/2 00:00:00 vi install.log
root 25234 25197 0 22:55 pts/3 00:00:00 grep vi
[root@localhost ~]# kill -9 25200
You have new mail in /var/mail/root
[root@localhost ~]#
结束进程后仍然有这个提示
E325: ATTENTION
Found a swap file by the name ".install.log.swp"
owned by: root dated: Fri Apr 30 22:54:45 2010
file name: ~root/install.log
modified: no
user name: root host name: localhost.localdomain
process ID: 25200
While opening file "install.log"
dated: Mon Mar 9 03:06:01 2009
(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 install.log"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file ".install.log.swp"
to avoid this message.
"install.log" 1079L, 45902C
Press ENTER or type command to continue
步骤二:
此时是由于缓存造成的删除缓存即可(注明此时的缓存文件在你打开的文件位置并不一定是当前的位置)
[root@localhost ~]# rm -rf .install.log.swp
此时即可打开即可正常
- vim Another program may be editing the same file.
- VIM Binary file editing
- web项目部署时总是提示May be locked by another process. Error copying file
- 移植ucos出現 Error: registers may not be the same -- `strexh r3,r2,[r3]' 處理
- Xcode出现unable to boot the simulator和an internal error occurred.editing functionality may be limited
- Ubuntu16.04 atom : Could not find 'uncrustify'. The program may not be installed.
- Sharepoint 修改文件夹名称时报错:The file is currently checked out or locked for editing by another user
- An internal error occurred.Editing functionality may be limited
- Appliation Loader上传App 莫名其妙的错误 The CFBundleExecutable of two bundles may not point to the same file.
- the same situation always be
- The Nook cannot read this file. it may be an unsupported format
- A class file was not written. The project may be inconsistent
- [Eclipse问题]A class file was not written. The project may be inconsistent
- 菜鸟解决方法 A class file was not written. The project may be inconsisten
- Socket file /var/lib/mysql/mysql.sock exists. Is another MySQL daemon already running with the same
- Socket file /tmp/mysql.sock exists. Is another MySQL daemon already running with the same unix socke
- Eclipse May be locked by another process错误解决
- eclipse tomcat May be locked by another process 解决
- SpannableStringBuilder的用法
- <opencv for android入门积累>Faltal exception :Main
- android设备功能之camera教程实例汇总
- WebApi编写
- 问题 Z 回形取数
- vim Another program may be editing the same file.
- 关于在SecureCRT中用pstree命令乱码问题
- 马小妹的android之旅——Context
- 问题 B 错误票据
- 加密芯片SMEC98SP使用之一
- MAC XAMPP搭建php开发环境,上传图片 move_uploaded_file出现错误 failed to open stream: Permission denied
- 【Maven资料】Maven生命周期1
- 有效的括号序列
- 时序(四)----有限状态机FSM