Для Vim 7.3+ есть еще один способ, который, я считаю, применим в этом случае. В $VIMRC
:
set undodir=~/.vim/undodir
set undofile
undodir
должен существовать.
С помощью Вима:
*'undodir'* *'udir'*
'undodir' 'udir' string (default ".")
global
{not in Vi}
{only when compiled with the |+persistent_undo| feature}
List of directory names for undo files, separated with commas.
See |'backupdir'| for details of the format.
"." means using the directory of the file. The undo file name for
"file.txt" is ".file.txt.un~".
For other directories the file name is the full path of the edited
file, with path separators replaced with "%".
When writing: The first directory that exists is used. "." always
works, no directories after "." will be used for writing.
When reading all entries are tried to find an undo file. The first
undo file that exists is used. When it cannot be read an error is
given, no further entry is used.
See |undo-persistence|.
*'undofile'* *'udf'*
'undofile' 'udf' boolean (default off)
local to buffer
{not in Vi}
{only when compiled with the |+persistent_undo| feature}
When on, Vim automatically saves undo history to an undo file when
writing a buffer to a file, and restores undo history from the same
file on buffer read.
The directory where the undo file is stored is specified by 'undodir'.
For more information about this feature see |undo-persistence|.
The undo file is not read when 'undoreload' causes the buffer from
before a reload to be saved for undo.
WARNING: this is a very new feature. Use at your own risk!