CtrlZTree brings tree-based undo/redo functionality to VS Code, inspired by the undotree for Vim. Unlike traditional linear undo/redo that loses alternative edit paths, CtrlZTree preserves all your editing history in a branching tree structure.
✨ Features
🌳 Tree-Based History
Branching History: Never lose edit alternatives when you undo and make new changes
Visual Tree View: See your entire editing history as an interactive graph
Smart Navigation: Click any node to instantly jump to that state
🎯 Enhanced Undo/Redo
Custom Undo/Redo: Replaces VS Code's default Ctrl+Z/Ctrl+Y with tree-aware operations
Alternative Keybinding: Ctrl+Shift+Z (Cmd+Shift+Z on Mac) also works for redo operations
Smart Empty File Undo: When file is empty and you press Ctrl+Z, automatically jumps to the latest non-empty state
Branch Selection: When multiple redo paths exist, choose which branch to follow
Content Preview: See previews of document states when selecting branches
📊 Interactive Visualization
Real-time Updates: Tree view updates automatically as you edit
Dynamic Editor Switching: Tree view automatically adapts when switching between different editor tabs/files
File-specific Trees: Each open file maintains its own history tree
Seamless Multi-Document Support: Single panel intelligently shows the history for whichever file is currently active
Visual Indicators: Current position highlighted in red, other states in blue
Enhanced Tooltips: Hover over nodes to see concise diff previews showing only changed lines
Smart Content Display: Tooltips show git-style diffs with intelligent truncation for large changes
Floating Diff Button: Click the "📊 View Diff" button below the current active node to see changes
Automatic Cleanup: Previous diff views close automatically when opening a new one
Read-Only Document Handling: Diff views and other read-only documents don't interfere with tree tracking
🚀 How It Works
Automatic History Tracking
CtrlZTree automatically tracks every change you make to your files, building a tree structure where:
Each node represents a unique document state
Each edge connects a parent state to a child state
Branches form when you undo and then make different changes