Vim:从以前未保存的会话加载更改

时间:2015-03-31 19:40:44

标签: vim

我编辑了文件X并关闭了文件但未保存。现在,当我尝试打开文件X vim警报"自上次更改后没有写入..."。

有没有办法让这些改变回来?

1 个答案:

答案 0 :(得分: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.