On , I learnt ...

Vim doesn’t create the persistent undo folder automatically

I have this in ~/.vimrc:

" Keep undo history between sessions
if has('persistent_undo')
    set undofile
    set undodir=~/.vim_undo
    set undolevels=2000

but, after switching laptops, I noticed the persistent undo feature wasn’t working.

The problem was that the ~/.vim_undo folder didn’t exist which silently prevents the feature working.

You can create this automatically in ~/.vimrc if you like.