VIM - 显示上次保存版本和当前未保存版本的差异 [英] VIM - Show the diff of last saved version and current unsaved version

查看:23
本文介绍了VIM - 显示上次保存版本和当前未保存版本的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<块引用>

可能的重复:
我可以在保存文件之前查看更改吗维姆?

<块引用>

重复:我可以在保存之前查看更改吗?Vim 中的文件?

有没有办法在 VIM 中查看同一文件的保存版本和编辑版本的差异?

这是这样的场景:我打开了一个文件,编辑了一些东西,但由于一些工作,我离开了电脑.过了一段时间我回来了,我忘记了我在编辑什么,我想看看上次保存的和当前未保存的同一文件版本之间的区别.有办法吗?

当然,我可以一直撤消直到最后一次更改并开始重做以返回到我未保存的版本.但我想看到的是差异.

解决方案

:w !diff % -

Possible Duplicate:
Can I see changes before I save my file in Vim?

Duplicate: Can I see changes before 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.

解决方案

:w !diff % -

这篇关于VIM - 显示上次保存版本和当前未保存版本的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆