Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo in Vim according to time?

Tags:

vim

Is there any way (like plug-in) to undo changes in Vim buffer according to time, like undo the changes in the last 30 minutes, or undo changes after 2pm today? I just found [count]u is not that useful for some change sequence which is a little long.

like image 745
Thomson Avatar asked May 19 '15 07:05

Thomson


1 Answers

To go back to a state of some earlier time you can use :earlier, e.g. to go back 30 minutes

:earlier 30m

:earlier takes relative times so to go back to a state at a certain time you would need to do the calculation yourself (but you could wrap that in a custom function).

To explore the undo tree plugins like Gundo can be very handy.

like image 172
Benjamin Bannier Avatar answered Oct 19 '22 02:10

Benjamin Bannier