Undo Tree

April 2, 2026 ยท View on GitHub

The undo tree shows the full history of changes to a file as a branching tree, rather than a linear undo/redo stack. This lets you explore and restore any past state, even across different edit branches.

Undo Tree view showing a branching edit history

Opening

Press gK in normal mode to open the undo tree panel for the current file. It appears in the left sidebar.

The tree is drawn as an ASCII graph:

  • (*) - the current position in the history
  • + - inactive branch

Each node shows a sequence number, relative timestamp, and a > marker if it matches the saved file state.

Editor Keybindings (normal mode)

KeyCommandDescription
gKundotree.toggleToggle undo tree panel
uvim.undoUndo
Uvim.redoRedo
<C-z>undoUndo (VSCode keybindings)

Undo Tree Panel Keybindings

KeyCommandDescription
<UP>next-changeMove to newer change
<DOWN>prev-changeMove to older change
<LEFT>left-changeJump to left branch (when on branch line)
<RIGHT>right-changeJump to right branch (when on branch line)
<S-UP>active-childGo to active child
<S-DOWN>parent-changeGo to parent node
<HOME>last-changeJump to newest change
<END>first-changeJump to oldest change
cselect-currentSelect current (active) change

Applying Changes

KeyCommandDescription
<ENTER>apply-selectedMake selected change the current one
atoggle-auto-applyToggle auto-apply (live preview while navigating)

Time-Based Jumps

Jump forward or backward by a time interval. Use count prefixes (e.g. 3sg to jump 3 seconds forward).

KeyCommandArgumentDescription
gnext-change-time1sForward 1 second
rprev-change-time1sBack 1 second
Gnext-change-time10mForward 10 minutes
Rprev-change-time10mBack 10 minutes
<PAGE_UP>next-change-time5sForward 5 seconds
<PAGE_DOWN>prev-change-time5sBack 5 seconds
<?>-count>sgnext-change-time<#count>sForward N seconds
<?>-count>srprev-change-time<#count>sBack N seconds
<?>-count>mgnext-change-time<#count>mForward N minutes
<?>-count>mrprev-change-time<#count>mBack N minutes
<?>-count>hgnext-change-time<#count>hForward N hours
<?>-count>hrprev-change-time<#count>hBack N hours
<?>-count>dgnext-change-time<#count>dForward N days
<?>-count>drprev-change-time<#count>dBack N days

Auto-Apply Mode

When auto-apply is off (default), navigating the tree only moves the selection highlight. Press <ENTER> to apply the selected state.

When auto-apply is on (toggle with a), the editor instantly switches to whichever node is selected. This is useful for quickly browsing through edit history.