Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM - Show the diff of last saved version and current unsaved version [duplicate]

Tags:

vim

diff

vimdiff

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.

like image 321
Srikanth Avatar asked Apr 17 '09 14:04

Srikanth


1 Answers

:w !diff % -
like image 108
chaos Avatar answered Nov 05 '22 18:11

chaos