3

Similar to this question, I want to keep my undo history when I change buffers. However, if I use set hidden, vim no longer prompts me when I switch from a buffer with changes.

How can I retain the unsaved buffer prompt but also retain my undo history?

Community
  • 1
  • 1
idbrii
  • 10,975
  • 5
  • 66
  • 107

1 Answers1

3

You can use the new persistent undo feature in Vim 7.3.

set undodir=~/.vim/undodir
set undofile

For details, see the documentation at

:help persistent-undo
hammar
  • 138,522
  • 17
  • 304
  • 385
  • 2
    Great! However, I had to add `if filewritable(&undodir) == 0 | call mkdir(&undodir, "p") | endif` after that to make sure that undodir exists. – idbrii May 11 '11 at 20:23