vim 文本编辑器排错

来源:互联网 发布:sql必知必会 百度云 编辑:程序博客网 时间:2024/06/05 10:30
例如:
E325: ATTENTION
Found a swap file by the name "/etc/.my.cnf.swp"
          owned by: root   dated: Fri Jan  9 16:14:10 2015
         file name: /etc/my.cnf
          modified: YES
         user name: root   host name: localhost.localdomain
        process ID: 10223
While opening file "/etc/my.cnf"
             dated: Sun Jan 11 22:57:22 2015
      NEWER 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 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 /etc/my.cnf"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/etc/.my.cnf.swp"
    to avoid this message.

Swap file "/etc/.my.cnf.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:

问题描述:
这是由于在编辑该文件的时候异常退出了,因为vim在编辑文件时会创建一个交换文件swap file以保证文件的安全性。

解决方案:
每次打开这个文件都会出现这个警告,为了去掉这个警告,需要删除这个swap文件: rm -f /etc/.my.cnf.swap 

这样烦人的警告就消失了。 有时是 删除 rm -f .my.cnf.swap  

查看一下:ls -a 就可以看到.my.cnf.swap 文件
0 0
原创粉丝点击