1

Problem:

The changes I make in files before closing are not saved in .swp files As I understand it, the swap file should save any changes if they are at least 200 characters long or nothing has been typed for 4 seconds

Steps to Reproduce:

  1. Create new file tmp.sql

  2. Write some text as a comment:

/* This is the comment I wrote. I did not save after I wrote it*/

  1. Close window after about 10 seconds have passed

  2. Restart Vim and open file using “:e”

  3. I get the usual .swp message from vim

  4. I type “r” to recover

Error Message:

Error: “Unable to read block 0 from /home/csarraille/docs/qua/tmp.sql

Maybe no changes were made or Vim did not update the swap file.

Environment:

  • My .swp files are stored in their own folder. I specify this in my .vimrc

    :set directory=$HOME/.vim/swapfiles//

  • I use Cygwin on a Windows machine to run Vim 8.0

Included Patches: 1-1567

2
  • 2
    I doubt this is it (hence comment), but the 200 characters/4 seconds are defaults and it's possible you've overridden them in .vimrc (or elsewhere). You can confirm these values with :set updatecount and :set updatetime.
    – brhfl
    Oct 29, 2018 at 19:20
  • 1
    Thank you @brhfl. My default settings were OK, but I appreciate knowing about how to set them in the future. Oct 29, 2018 at 23:12

1 Answer 1

1

I'm not sure why, but rather than what I had in my .vimrc for .swp file management, which was:

set directory=$HOME/.vim/swapfiles//

...The error described below has resolved by using this, placed at the very end of my .vimrc:

set directory=/tmp//

For users of Cygwin, perhaps placing the swapfile directory within the .vim directory does not work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.