I have an install of Cygwin on a Windows 10 machine. I am trying to enable undo history in vim so that it is remembered between vim instances. At the moment everything is forgotten after closing the editor. My .exrc includes the following:

set undofile
set undodir=$HOME/.vim/undo
set undolevels=1000
set undoreload=10000

I did have a problem with .swp files not being opened correctly. Apparently the directory didn't exist and vim wasn't able to create one itself. However, $HOME/.vim/undo definitely exists:

drwx------+ 1 xxx Domänen-Benutzer 0 May 18 14:19 tmp
drwx------+ 1 xxx Domänen-Benutzer 0 May 18 14:20 undo

I have tried following this question and this one, including setting the following:

set nocompatible

I have also tried following this advice and set:

set undodir=$HOME/.vim/undo

However, it still does not work. Any other ideas what might be missing?

  • Edit a file (perhaps with vim --noplugin), :set verbose=1, and :w. If it were working it would say Writing undo file: {filename}. What does yours say? – B Layer May 18 '18 at 14:27
  • Nothing. Simply "test" 5L, 29C written – Druckles May 18 '18 at 15:05
  • It's not even trying? When you do :set everything there looks as expected (esp. undofile and undodir)? What happens when you try to write to the undodir directly, e.g. :exec 'w ' . &undodir . '/tmp.txt' – B Layer May 18 '18 at 20:05
  • Nothing. It returns with no output and the file is not written. But then :echo 'something' doesn't do anything either. – Druckles May 22 '18 at 11:45

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.