Vim:从上一个未保存的会话加载更改

Vim: load changes from previous unsaved session

我编辑了文件 X 并在没有保存的情况下关闭了文件。现在,当我尝试打开文件 X vim 时,警报 "No write since last change...".

有没有办法恢复这些更改?

以下解释来自: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.