Feature Request: Text Selection with Keyboard in Chat Input [Shift + (arrow key)]
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Summary
Add keyboard-based text selection (Shift + arrow keys) and standard cut/paste operations (Ctrl+X, Ctrl+V) to the chat input area.
Problem Statement
When typing a prompt, I sometimes think of a higher-priority question I need to ask first. Currently, the workflow to temporarily save my in-progress prompt is cumbersome:
Current workflow:
- Use mouse to click and drag to select text
- Right-click to copy to clipboard
- Manually delete all selected text (Backspace/Delete)
- Type new urgent question
- Wait for response
- Paste original prompt back
This breaks flow and requires switching between keyboard and mouse repeatedly.
The Muscle Memory Problem
While Claude Code has Ctrl+S to stash the entire prompt, users instinctively reach for Shift + arrows due to decades of muscle memory from:
- Every text editor (VS Code, Sublime, Notepad++, etc.)
- Web browsers
- IDEs
- Office applications
- Even most modern CLI tools
When that familiar keystroke doesn't work, it creates friction. Users find themselves:
- Repeatedly trying Shift+arrow and being confused when nothing happens
- Breaking concentration to remember "oh right, I need to use the mouse here"
- Or learning an entirely new paradigm (Vim mode) just for text selection
The Ctrl+S stash feature is helpful for saving entire prompts, but it doesn't address the fundamental expectation: Shift should select text.
Proposed Solution
Proposed Solution
Add standard text selection keybindings to the chat input area:
Text Selection
- Shift + Left/Right Arrow - Select text character-by-character
- Shift + Up/Down Arrow - Select text line-by-line (for multi-line input)
- Ctrl + Shift + Left/Right - Select word-by-word (optional enhancement)
- Ctrl + A - Select all text (if not already bound)
Cut/Copy/Paste
- Ctrl + X - Cut selected text to clipboard
- Ctrl + C - Copy selected text to clipboard (while in selection mode)
- Ctrl + V - Paste from clipboard
Note: Ctrl+C is currently bound to interrupt/exit. The selection-mode Ctrl+C would only apply when text is actively selected, maintaining the existing interrupt behavior when no selection exists.
Desired Workflow
- Type initial prompt: "Can you help me refactor the authentication module..."
- Think of urgent question
- Shift + Ctrl + A to select all text
- Ctrl + X to cut text
- Type urgent question: "What files handle user sessions?"
- Submit and get answer
- Ctrl + V to paste original prompt back
- Continue editing original prompt
Prior Art
Text selection with Shift + arrows is standard in most CLI tools:
- Bash/Zsh readline - Supports selection in some configurations
- Fish shell - Has visual selection mode
- Helix editor - Uses selection-first editing model
- VS Code terminal - Supports Shift + arrow selection
- Windows Terminal - Supports Shift + arrow selection
- Most GUI text inputs - Universal pattern users expect
Benefits
- Improved efficiency - Keyboard-only workflow is faster than mouse operations
- Better accessibility - Not all users can easily use mouse for precise text selection
- Consistency - Matches user expectations from other applications
- Flow preservation - No context-switching between keyboard and mouse
Alternative Solutions
Existing Workarounds (and why they're insufficient)
Vim Mode
- Pro: Has visual mode (
v), yank (y), paste (p) - Con: Requires learning Vim keybindings, modal editing mindset
- Con: Uses
dfor delete/cut, not Ctrl+X - inconsistent with standard shortcuts - Verdict: Great for Vim users, but adds learning curve for others
External Editor (Ctrl+G)
- Pro: Full text editing in system editor
- Con: Opens separate window/buffer - breaks flow
- Con: Overkill for quick text selection operations
- Verdict: Useful for heavy editing, not for quick selection tasks
Prompt Stash (Ctrl+S)
- Pro: Can save and restore the entire current prompt
- Pro: Built-in, no setup required
- Con: Only stores one prompt at a time (no queue/history)
- Con: All-or-nothing - can't select and manipulate partial text
- Con: Doesn't match the Shift+arrow muscle memory users already have
- Verdict: Excellent for whole-prompt switching, but doesn't address the core UX gap of text selection
Terminal Selection
- Pro: Some terminals support Shift + arrow
- Con: Selects terminal output, not input buffer specifically
- Con: Inconsistent behavior across terminals
- Verdict: May work sometimes but unreliable
Motivation
Claude Code is an exceptional tool, and keyboard-based text selection would make the input experience even more polished and efficient. This is a quality-of-life improvement that would benefit both casual users (who expect standard text selection) and "almost power coders" (who want keyboard-only workflows without learning Vim).
Priority
Medium - Would be very helpful
Feature Category
Interactive mode (TUI)
Use Case Example
Use Cases
- Reordering thoughts - Move text around within a long prompt
- Temporary prompt switching - Set aside a complex prompt to ask a quick question
- Extracting snippets - Copy part of a prompt to use elsewhere
- Iterative refinement - Cut and rework sections of a prompt without retyping
Additional Context
Technical Considerations
The chat input area is built with Ink (React-based TUI framework). Text selection would require:
- Selection state management - Track selection start/end positions
- Visual feedback - Render selected text with inverse/highlighted colors
- Keybinding handlers - Add Shift+arrow and Ctrl+X/V handlers to the Chat context
- Clipboard integration - Already exists for Ctrl+V (image paste), extend for text
- Context-aware Ctrl+C - Only copy when text is selected, otherwise interrupt
Related Issues
- Keybindings documentation: https://code.claude.com/docs/en/keybindings
- Vim mode support (existing alternative): Added in v2.1.0
Implementation Scope
Minimum Viable Feature
- Shift + Left/Right arrow selection
- Ctrl + X (cut), Ctrl + V (paste)
- Visual indication of selected text
Nice-to-Have Enhancements
- Shift + Up/Down for line-based selection
- Ctrl + Shift + Left/Right for word-based selection
- Ctrl + A for select all
- Ctrl + C for copy (when text selected)
- Mouse click-and-drag selection (if not already supported)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗