让我以这种方式提出这个问题.我在
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.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。