使用vi編輯器編輯文件時,常常會因爲非正常退出而產生一個swp文件,之後每次進入時都會提示,很是麻煩。現將網上搜集的解決方法陳列於此:html
vim -r help.txt
Using swap file ".help.txt.swp"
Original file "~/vim/runtime/doc/help.txt"
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)
Delete the .swp file afterwards.
使用交換文件 ".help.txt.swp"
原文件 "~/vim/runtime/doc/help.txt"
恢復完成. 請肯定一切正常.
(你可能想要把這個文件另存爲別的文件名,
再執行 diff 與原文件比較以檢查是否有改變)
以後能夠刪除交換文件。
:write help.txt.recovered
vimdiff main.c~ main.c
+ +--123 lines: /* a
|+ +--123 lines: /* a| <- 摺疊 text
| text | text
| text | text
| text | text
| changed text | <- 修改過的行 text
| text | text
| ------------------| <- 刪除的行 text
| text | text
| text | text
| text |+ +--432 lines: text
|+ +--432 lines: text| <- 摺疊 ~
| ~ | ~
| ~ |main.c~==============main.c==============
|
| :edit main.c
:vertical diffsplit main.c
:edit main.c
:vertical diffpatch main.c diff
:set noscrollbind
]c
[c
:diffupdate
:dp
:do