Feature Request: Add Undo Functionality to Claude Code Prompt Text Area

Resolved 💬 3 comments Opened Aug 15, 2025 by NightMachinery Closed Aug 15, 2025

Summary

Add undo capabilities to Claude Code's prompt text area with keyboard shortcuts:

  • u in normal mode (vim-style undo)
  • Ctrl+Z in all modes (universal undo)

Current State

Claude Code currently supports extensive vim-style text editing shortcuts in the prompt area including:

  • Navigation (h/j/k/l, w/e/b, 0/$)
  • Editing (x, dd, D, dw/de/db, cc, C)
  • Insert modes (i/I/a/A/o/O)
  • Repeat last change (.)

However, there is no undo functionality available, which is a fundamental text editing operation.

Proposed Feature

Implement undo functionality with two keyboard shortcuts:

  1. u in normal mode: Vim-style undo command
  • Follows vim conventions that users already expect
  • Consistent with existing vim-style shortcuts
  • Only active in normal mode to avoid conflicts
  1. Ctrl+Z in all modes: Universal undo
  • Works in both normal and insert modes
  • Familiar to users from standard text editors
  • Provides accessibility for non-vim users

Use Cases

  • Accidental deletions: Users can recover from mistaken dd, D, or x operations
  • Experimental editing: Users can try different approaches and revert changes
  • Workflow continuity: Matches expectations from vim and standard editors
  • Error recovery: Quick recovery from typing mistakes or unwanted changes

Implementation Considerations

  • Maintain undo history for the current session
  • Consider undo stack depth (suggest 50-100 operations)
  • Ensure undo works with all existing editing operations
  • Handle mode transitions properly (undo should work regardless of current mode)

Priority

Medium-High - This is a fundamental text editing feature that users expect in any editor with vim-style controls.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗