Is there a way to rename/copy/move a file and maintain the vim persistent undo information?
If I do
:w new-file-name
and then
:e new-file-name
I can't hit u to undo. Already at oldest change
:-(
Using :saveas
keeps the undo history intact.
:saveas
is equivalent to the combination of :w newname
followed by :e #
. I usually find it more handy than the :w
+ :e
, especially since with :saveas
it's not really possible to forget about doing the second command and end up editing the first file. (Which you can guess is something I've done more than once!)
Tim Pope created eunuch plugin with such feature. It has :Move
and :Rename
commands. Do not know if it works under Windows since description is about UNIX shell commands, can't test it right now. Also as filbranden said you can copy with :saveas
.