如何撤消最后写入vim?
发布时间:2020-12-16 01:25:44 所属栏目:安全 来源:网络整理
导读:让我以这种方式提出这个问题.我在 vim中打开一个新文件,(版本1) #includestdio.hmain(){...blah} 然后使用 Esc:w Enter写文件.然后做出修改(版本2) #includestdio.hmain(){...blah... edit1... edit2 //and large number of changes here and there in code
让我以这种方式提出这个问题.我在
vim中打开一个新文件,(版本1)
#include<stdio.h> main() { ...blah } 然后使用< Esc>:w< Enter>写文件.然后做出修改(版本2) #include<stdio.h> main() { ...blah ... edit1 ... edit2 //and large number of changes here and there in code } 然后使用&Esc.>:w< Enter> ;.保存更改. 有没有办法直接撤消对版本1的更改(因为它是最后一个保存),即不经常按u来撤消
从Vim的帮助:
:earlier {N}f Go to older text state {N} file writes before. When changes were made since the last write ":earlier 1f" will revert the text to the state when it was written. Otherwise it will go to the write before that. When at the state of the first file write,or when the file was not written,":earlier 1f" will go to before the first change. 所以,如果您在第二次保存后没有进行更改,可以使用以下操作: :earlier 1f 另一方面,如果您在第二次保存后未保存更改,则: :earlier 2f 会解决你的问题. 请参阅:help:之前,:help:undolist. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |