2017-10-15 260 views
0

我有一些問題恢復崩潰的文件在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備份文件的文件。反正如何處理這樣的問題

回答

0

我剛剛發現.py.swp文件不符合現有的.py文件,這就是爲什麼vim總是重新打開.py文件。刪除.py文件並通過vim -r打開.py.swp解決了該問題。