[FEATURE] Enhanced Vim Mode: Support for Text Objects and More Complete Vim Command Set
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
Claude Code's vim mode currently supports only basic navigation and editing commands (h/j/k/l, dd, cc, i/a/o, etc.) but lacks support for text objects - one of vim's most powerful and fundamental features.
Text objects allow operators like d (delete), c (change), y (yank), and v (visual) to work on semantic units like "inner word" (iw), "inside quotes" (i"), or "around parentheses" (a().
Without text objects, vim users cannot execute essential commands like:
- ciw - change inner word
- di" - delete inside quotes
- ci{ - change inside braces
- yap - yank around paragraph
This severely limits vim mode's usability. Vim users rely on these commands hundreds of times daily - they're muscle memory, not optional features. The current implementation feels
incomplete and breaks the editing flow that makes vim efficient.
Proposed Solution
Implement comprehensive text object support in Claude Code's vim mode, including:
Text Objects:
- iw/aw - inner/around word
- i"/a", i'/a' - inner/around quotes (single/double)
- i(/a(, i{/a{, i[/a[ - inner/around brackets/braces/parens
- it/at - inner/around tag (HTML/XML)
- ip/ap - inner/around paragraph
- is/as - inner/around sentence
Operators working with text objects:
- d{text-object} - delete
- c{text-object} - change
- y{text-object} - yank
- v{text-object} - visual select
Additional essential vim commands:
- y/yy - yank (copy)
- p/P - paste after/before
- u - undo
- Ctrl+r - redo
- r - replace character
- f/F/t/T - find/till character
- % - jump to matching bracket
- /, ?, n, N - search
- v/V - visual/visual line mode
- Number prefixes (3dd, 2w, 5j)
Alternative Solutions
Option 1: Gradual rollout
- Phase 1: Implement most common text objects first (iw/aw, i"/a", i(/a(, i{/a{)
- Phase 2: Add remaining quote/bracket variants
- Phase 3: Add paragraph, sentence, tag support
Option 2: Vim mode levels
- Keep current "basic vim mode" as default
- Add /vim advanced or /vim full for complete text object support
- Allow users to opt-in to fuller vim emulation
Option 3: Integration with existing vim parsers
- Consider leveraging established vim emulation libraries rather than building from scratch
- Reference implementations: VS Code's vim extension, CodeMirror vim mode
Priority
Medium - Would be very helpful
Feature Category
Interactive mode (TUI)
Use Case Example
Example 1: Refactoring variable names
const userEmail = "test@example.com";
User wants to change userEmail to emailAddress:
- Current: Must use wwwdwdwdw or enter INSERT mode and manually edit
- With text objects: ciw when cursor is anywhere on userEmail, type new name
Example 2: Changing string content
String message = "Hello, World!";
User wants to change the string content:
- Current: Must navigate precisely, enter INSERT mode, manually select and delete
- With text objects: ci" from anywhere inside the quotes, type new content
Example 3: Deleting function arguments
def calculate(price, tax, discount):
User wants to remove all arguments:
- Current: Multiple keystrokes with precise positioning
- With text objects: di( when cursor is inside parentheses
Example 4: Editing JSON
{"name": "John", "age": 30}
User wants to change the age value:
- With text objects: Navigate to age value, ci" (if string) or ciw (if number)
- Current: Manual character-by-character deletion or INSERT mode editing
Additional Context
Why this is critical:
- Muscle memory: Vim users have spent years building muscle memory around text objects. These aren't advanced features - they're baseline expectations.
- Efficiency: Text objects make vim efficient. Without them, vim mode is just awkward arrow-key navigation with extra steps.
- Industry standard: Every mature vim implementation (Neovim, VS Code Vim, IntelliJ IdeaVim, Kakoune) supports text objects. This is table-stakes for vim emulation.
- User retention: Vim users are passionate about their workflow. Incomplete vim support may drive them away from Claude Code entirely.
- Developer empathy: The Claude Code team are developers who likely understand this pain firsthand. Every developer who uses vim has typed ciw instinctively.
References:
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗