Tente colocar isso no seu arquivo ~ / .vimrc :
set hid
Se eu estiver editando dois arquivos com o vim, mudar para o outro arquivo (: bnext,: bprev) parece deixar o histórico de desfazer a partir do arquivo aberto - pressionando os relatórios de tecla 'u' "Já na alteração mais antiga".
Por exemplo:
vim testfile1 testfile2
:w
:bn
:bp
u
Existe alguma maneira de manter este histórico para buffers não visíveis?
Para o Vim 7.3+, existe outra maneira que acredito ser aplicável neste caso. Em $VIMRC
:
set undodir=~/.vim/undodir
set undofile
O undodir
precisa existir.
Da ajuda do Vim:
*'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!
Você pode mover o arquivo e mencionar explicitamente o nome da undo-file
: link
Tags vim