Wouldn’t it be nice if you could view an old version of a file side by side with the current one in Vim? And it would scroll together? And syntax highlight?
Well, open the current file in a Vim window. Then do the following:
Open a new (blank) split or window:
1
:vspnew
Dump the old file contents in this new buffer: (note: ‘!’ executes a shell command, and ‘read’ puts it in the current buffer)
1
:read!git show HEAD^:path/to/file/from/root.py
Set the right syntax highlighting:
1
:setf python
Scroll bind the two splits: (note: you must run this command in both splits)
1
:setscrollbind
Hope this helps. Let me know if there’s a better way to do this.