I have the following in my .vimrc file:

if has('persistent_undo')
    " Save all undo files in a single location (less messy, more risky)...
    set undodir=$HOME/.VIM_UNDO_FILES

    " Save a lot of back-history...
    set undolevels=5000

    " Actually switch on persistent undo
    set undofile


I've created the .VIM_UNDO_FILES in my home directory and have verified VIM has persistent_undo compiled in. Yet, when I close out a vim file and reopen, I cannot undo anything I did before the file was closed. Maybe I misunderstand how this is supposed to work.

I tried commenting out the if/endif and that didn't help. I also tried changing $HOME to ~. that did not work either.

Also, the .VIM_UNDO_FILES file size never grows. It's stuck at 0.

1 Answer 1


OK, I'm a dummy. I needed to create .VIM_UNDO_FILES as a dir not a file.

Your Answer

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

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