When I open up a file remotely using scp
(and possibly other protocols), running the undo
command (right away, or repeatedly if I've made edits) clears the file. Why does this happen - is it a bug?
My guess is that it is a quirk of how remote editing is implemented - like Vim is actually opening a new local file, and then the first change
is to copy all the text of the remote file into the new file.
:set undoreload=0 | edit
once file is open. This cut the undo history. I however could not make it exec automatically withautocmd
. Triedautocmd EVENT scp://* :set undoreload=0 | edit
with EVENT either of BufRead BufEnter BufFilePost.