Undo and redo document changes with familiar keyboard shortcuts. Track up to 100 editing actions. Press Cmd+Z to undo, Cmd+Shift+Z to redo.

How it works

  • Automatic grouping - Changes within 500ms are grouped as one action
  • Deep history - Stores up to 100 undo steps by default
  • Smart tracking - Preserves selection and cursor position

Why you’d use this

  • Mistake recovery - Quickly undo accidental deletions or changes
  • Experimentation - Try different edits knowing you can revert
  • User confidence - Standard feature users expect in any editor

Options

Configure the extension behavior:
depth
number
default:"100"
Maximum undo/redo steps to remember
newGroupDelay
number
default:"500"
Milliseconds to wait before starting a new history group
Usage:
History.configure({
  resizable: false,
  cellMinWidth: 50
})

Commands

undo

Undo the last action
Groups changes within the newGroupDelay window
undo()

redo

Redo the last undone action
Only available after an undo action
redo()

Keyboard Shortcuts

CommandShortcutDescription
undo()⌘/Ctrl-zUndo last action
redo()⌘/Ctrl-Shift-zRedo last action
redo()⌘/Ctrl-yRedo last action (alternative)

Types

HistoryConfig

History configuration