2015-03-31 26 views
0

我編輯了文件X並關閉了文件,但未保存它。現在,當我嘗試打開文件X vim警報「自上次更改後沒有寫入...」。Vim:從以前未保存的會話中加載更改

有沒有辦法讓這些變化回來?

+0

你的問題是不完美的清晰。你是否用':q!'來關閉文件?你退出了編輯器還是隻刪除了一個緩衝區?我無法重現你所描述的內容。你能更精確嗎? – 2015-03-31 20:28:14

回答

1

下面解釋從:help message

             *E37* *E89* 
    No write since last change (add ! to override) 
    No write since last change for buffer {N} (add ! to override) 

You are trying to |abandon| a file that has changes. Vim protects you from 
losing your work. You can either write the changed file with ":w", or, if you 
are sure, |abandon| it anyway, and lose all the changes. This can be done by 
adding a '!' character just after the command you used. Example: > 
     :e other_file 
changes to: > 
     :e! other_file 

                 *E162* 
    No write since last change for buffer "{name}" 

This appears when you try to exit Vim while some buffers are changed. You 
will either have to write the changed buffer (with |:w|), or use a command to 
abandon the buffer forcefully, e.g., with ":qa!". Careful, make sure you 
don't throw away changes you really want to keep. You might have forgotten 
about a buffer, especially when 'hidden' is set. 


    [No write since last change] 

This appears when executing a shell command while at least one buffer was 
changed. To avoid the message reset the 'warn' option.