恢复vim失败

恢复vim失败

问题描述:

我有一些问题恢复崩溃的文件在vim中。我有一个.test.py.swp文件,其中还包含一些可读的行,还有字符串choice。当我尝试使用-r选项或打开并按RE打开相应的test.py文件时,该字符串不存在。它给我的留言:恢复vim失败

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备份文件的文件。反正如何处理这样的问题

我刚刚发现.py.swp文件不符合现有的.py文件,这就是为什么vim总是重新打开.py文件。删除.py文件并通过vim -r打开.py.swp解决了该问题。