如果在使用vim打开某个文件时出现以下内容,是因为上次打开文件后未正常关闭,留下了一个文件名加.swp后缀的文件(隐藏文件),删除这个.swp文件便能正常打开文件了
E325: ATTENTION
Found a swap file by the name "/etc/.exports.swp"
owned by: root dated: Wed Aug 24 23:39:12 2022
file name: /etc/exports
modified: YES
user name: root host name: nfs
process ID: 5732 (still running)
While opening file "/etc/exports"
dated: Wed Aug 24 23:40:34 2022
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/exports"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/etc/.exports.swp"
to avoid this message.
Swap file "/etc/.exports.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:
记住上面提示的隐藏文件的名称 --> 倒数第二行:/etc/.exports.swp
在文件所在文件夹中进行操作
使用命令rm -rf .exports.swp
既可正常打开文件进行编辑