0

I'm having some graphical issues with my setup that means I sometimes need to restart my machine having not saved a file which is currently being edited in vim. However, the saved file which vim recovers upon me restarting the machine, is the version of the file which was originally opened at the beginning of the last session, as opposed to the most recently saved version.

Example: Suppose I open this.txt which contains this and this, I make some changes: this and this and that and write the file; :w. I make a further (but now unsaved) change of this and this and that and this and restart the machine without saving/closing the vim session. When I open the file again, it gets reverted to the original version of this and this, as opposed to the most recently saved version. What's going on?

The most relevant setting in my .vimrc are the lines:

set undofile
set undodir=~/.vim/undo/

which at some point I thought was a solution, however it isn't.

2
  • :h recover.txt
    – Matt
    Apr 29 at 5:41
  • Thanks. Okay this reminds me, at some point swap files have ceased to be created within the working directory. :swapname tells me that swap files are in ~.cache/vim/swap/... but this never used to be the case.
    – algae
    Apr 29 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.