Michael F. Lamb wrote:
Hello all,

When I see the "swapfile exists" warning in vim, I choose (R)ecover, then write to a temporary file, diff the new file with the old, find that there are no differences, then delete the temporary and .swp files. I'd like to avoid this procedure when (as is the case more often than not) there are no changes between the recovered file and the last saved version.

One bit of data shown upon recovery is:
"modified: no"

What precisely does this tell me about the state of my work?

If I know that I'm not running another vim at the time, may I rely on this to avoid having to do the write-diff-delete procedure and simply choose to (D)elete the old swapfile at the prompt?

If not, has anyone written a vim plugin that automatically 'vimdiff's the recovered file with the existing file?

Thanks in advance.


"modified:no" means that the 'modified' buffer-local option (which can be set manually but is normally set when making changes and reset either by saving the file or by undoing all changes) was OFF when the swapfile was last written. Another item that may be of interest is (when pesent) a line saying "NEWER than swap file". See ":help ATTENTION" for details.

If you know (after double-checking) that no other Vim is using that swapfile, and if you can deduce that the file was saved before the crash, then you can safely (D)elete the swapfile. But don't make it a reflex action: you should always make sure before you delete, because once deleted, the same swapfile will immediately be overwritten (i.e., reused as the swapfile for the file which caused the warning message to pop up).

Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
146. You experience ACTUAL physical withdrawal symptoms when away
     from your 'puter and the net.

Reply via email to