在编辑器外编辑文件时,Vim 撤消文件将被清除。
我怎样才能得到它以便我可以将文件恢复到旧版本,即使它是在 Vim 之外编辑的?这可能吗?
最佳答案
您可以使用 vim 备份:
set backup " enable backup file
set backupdir=~/.vim/backups " backup directory
然后你可以去获取保存的最后一个备份 vim,以防你想在外部编辑后恢复,但这不像撤消文件。 From vim wiki :
However, note that if a file is modified externally without Vim, Vim will not be able to read the undo history back when you start editing the file again and the undo tree information will be lost. There is no way to get it back.
关于vim - 如果在 Vim 之外编辑文件,则保留撤消历史记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16975891/