我注销了,显然忘记将 vim 会话带回前台。正如预期的那样,vim 吐出“Vim:捕获致命信号 HUP”,然后是“Vim:保留文件”。
我的问题是:哪些文件被保留?我猜这些是已编辑但未保存的文件;那些保存在哪里?我如何找到他们?
答案1
当 时"Vim: caught deadly signal HUP" followed by "Vim: preserving files".
,所有正在编辑的文件都被保存到交换文件中。根据vim
手册:
The name of the swap file is normally the same as the file you are editing,
with the extension ".swp".
- On Unix, a '.' is prepended to swap file names in the same directory as the
edited file. This avoids that the swap file shows up in a directory
listing.
- On MS-DOS machines and when the 'shortname' option is on, any '.' in the
original file name is replaced with '_'.
- If this file already exists (e.g., when you are recovering from a crash) a
warning is given and another extension is used, ".swo", ".swn", etc.
- An existing file will never be overwritten.
- The swap file is deleted as soon as Vim stops editing the file.
默认情况下,交换文件与原始文件存储在同一目录中。您可以使用以下命令找到它:
ls -la .filename.swp