我在vim中恢复崩溃的文件时遇到了一些问题。我有一个.test.py.swp文件,其中还包含一些可读行,还包括字符串choice
。当我尝试使用-r
选项打开相应的test.py文件或打开并按下R
或E
时,字符串不存在。它给了我一个信息:
E325: ATTENTION
Found a swap file by the name ".analyze_minima_results.py.swp"
owned by: sringe dated: Sun Oct 15 14:37:00 2017
file name: /scratch/users/sringe/MinimaHopping/analyze_minima_results.py
modified: YES
user name: sringe host name: sherlock-ln01.stanford.edu
process ID: 22589
While opening file "analyze_minima_results.py"
dated: Sun Oct 15 12:32:49 2017
(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 analyze_minima_results.py"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file ".analyze_minima_results.py.swp"
to avoid this message.
Swap file ".analyze_minima_results.py.swp" already exists!
"analyze_minima_results.py" 382L, 11693C
Using swap file ".analyze_minima_results.py.swp"
Original file "/scratch/users/sringe/MinimaHopping/analyze_minima_results.py"
E308: Warning: Original file may have been changed
Recovery completed. You should check if everything is OK.
(You might want to write out this file under another name
and run diff with the original file to check for changes)
You may want to delete the .swp file now.
似乎出了问题,因为恢复的文件不包含字符串choice
。还有其他选项可以完全恢复.swp
文件吗?我真的需要文件中的代码......
我实际上可以从目录中的.nfsxxxxxxx
备份文件中恢复文件。无论如何如何处理这样的问题会很好
答案 0 :(得分:0)
我刚发现.py.swp
文件与现有的.py
文件不匹配,这就是为什么vim总是重新打开.py
文件的原因。删除.py
文件并通过.py.swp
打开vim -r
解决了此问题。