Recover an earlier text state
:earlier 5m or :later 5m
Example
Normal mode. Current text: draft ready. Retained state about five minutes earlier: draft.
Before
About five minutes ago: draft
Current text: draft ready
- :earlier 5m<CR> Earlier text state · draft
- :later 5m<CR> Toward newer state · draft ready; timing determines destination
After
After :earlier 5m: draft
After :later 5m: draft ready
Details & Vim help
Move through undo history by approximate elapsed time, including branches.
Find a version from before a detour even after making a new undo branch.
This changes the buffer’s text. It can only reach retained undo history; restarting Vim needs persistent undo if you want earlier sessions. Times are approximate.
Illustrative retained history. Actual text states depend on edit timestamps and available undo history.
Try it in Vim
- Run :earlier 5m to revisit a text state from about five minutes earlier.
- Inspect the buffer before saving.
- Use :later 5m to move toward newer states; g- and g+ traverse individual chronological states.