I have a file opened and I know I can do :diffsplit to open the file in a diff view.

I also know that I can do something like :earlier 30m to see how the file was 30 minutes ago.

My question is: how do I combine them and open a diff in a split to see the differences between now and 30 minutes ago?

  • 4
    the undotree and gundo plugin allows that. Even my old histwin plugin allows that. It can be done manually, but it requires stepping through the undo tree, saving the buffer contents into a variable, restoring the undo state, opening a split window with the old buffer contents and creating a diff of that. Oct 23, 2018 at 11:26

1 Answer 1


map this to some keybinding -

:earlier 1f \| DiffOrig<CR>

you will need difforig in your vimrc:

if !exists(":DiffOrig")
  command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
          \ | wincmd p | diffthis

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.