VIM - 显示上次保存版本和当前未保存版本的差异
可能的重复:
我可以在保存文件之前查看更改吗Vim?
有没有办法在 VIM 中查看同一文件的保存版本和编辑版本的差异?
这是这样的场景:我打开了一个文件,编辑了一些内容,然后由于一些工作而离开了计算机。 一段时间后,我回来了,我忘记了我正在编辑的内容,我想看看同一文件的上次保存版本和当前未保存版本之间的差异。 有办法做到吗?
当然,我可以继续撤消直到最后一次更改,然后开始重做以返回到未保存的版本。 但我想看到的是差异。
Possible Duplicate:
Can I see changes before I save my file in Vim?
Is there a way to see the diff of the saved version and the edited version of the same file in VIM?
This is the scenario: I've opened a file, editing something and I went away from the computer due to some work. After sometime I returned back and I forgot what I was editing and I would like to see the difference between the last saved and the current unsaved version of the same file. Is there a way to do it?
Of course, I can keep undoing till the last change and start redoing to go back to my unsaved version. But what I would like to see is a diff.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
显然 :DiffOrig 做的事情与自定义函数相同,在 Golubyev 先生的帖子中做了几个深入的链接。 不过,默认情况下它可能只存在于较新版本的 Vim 中。
Apparently :DiffOrig does the same thing as the custom function did a couple links deep into Mr. Golubyev's post. It may only be in newer versions of Vim by default, though.