加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

如果在Vim之外编辑文件,则保留撤消历史记录

发布时间:2020-12-15 22:38:03 所属栏目:安全 来源:网络整理
导读:在编辑器外编辑文件时,将清除Vim undofile. 我怎样才能得到它所以我可以将文件还原为旧版本,即使它是在Vim之外编辑的?这可能吗? 解决方法 你可以使用 vim备份: set backup " enable backup fileset backupdir=~/.vim/backups " backup directory 然后你可
在编辑器外编辑文件时,将清除Vim undofile.

我怎样才能得到它所以我可以将文件还原为旧版本,即使它是在Vim之外编辑的?这可能吗?

解决方法

你可以使用 vim备份:

set backup                   " enable backup file
set backupdir=~/.vim/backups " backup directory

然后你可以去抓取最后一个备份vim保存,以防你想在外部编辑后恢复,但这不像undofile. 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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读