[FEATURE] Vim-style word completion (Ctrl+P/Ctrl+N) in insert mode
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
When composing prompts in Claude Code with Vim mode enabled, there's no way to auto-complete words from the conversation history or current prompt buffer. This is a standard feature in Vim's insert mode that significantly speeds up editing, especially when working with long technical terms, file paths, or previously mentioned concepts that appear multiple times in a conversation.
Current Behavior:
- Vim mode supports navigation (h/j/k/l), text objects (ciw, diw), and basic editing
- No word completion available in insert mode
- Users must manually retype long or technical terms that appeared earlier in the conversation
Why This Matters:
When iterating on prompts or referencing concepts from earlier in the conversation, users frequently need to type the same technical terms, file names, or domain-specific vocabulary repeatedly. In standard Vim, Ctrl+P and Ctrl+N provide word completion from the current buffer, which is muscle memory for Vim users and dramatically improves editing efficiency.
Proposed Solution
Implement Vim-style word completion in insert mode:
Ctrl+P: Search backward through conversation history for word completions
Ctrl+N: Search forward through conversation history for word completions
Completion Sources (in priority order):
- Current prompt input (words already typed in the current prompt)
- Conversation history (words from previous messages in the session)
- Optionally: Project file names and common terms
Behavior:
- Pressing
Ctrl+Pwhile typing a partial word shows matching completions from history - Repeated presses cycle through matches
EscapeorCtrl+[cancels completion and returns to normal insert mode- Tab or Enter accepts the completion
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
Example Use Case
Scenario: Working on a project with long technical terms
> Please refactor the AuthenticationService to use dependency injection
[Claude responds with code changes]
> Now update the tests for Authent<Ctrl+P>
^
Auto-completes to "AuthenticationService"
Another scenario: Referencing file paths mentioned earlier
> Check the error in src/components/UserDashboard/ProfileSettings.tsx
[Discussion continues...]
> Now apply the same pattern to src/compo<Ctrl+P>
^
Cycles through:
- src/components/UserDashboard/ProfileSettings.tsx
- src/components/...
Benefits
- Consistency: Matches Vim behavior that users already know
- Efficiency: Reduces repetitive typing of long terms
- Accuracy: Avoids typos when reusing complex terms
- Muscle Memory: Vim users instinctively use Ctrl+P/Ctrl+N
- Cognitive Load: Less mental effort remembering exact spelling of terms from earlier in conversation
Additional Context
Alternative Considered
Using shell-style history completion (Ctrl+R for reverse search) could work, but:
- Less intuitive for Vim users
- Doesn't match the Vim editing paradigm Claude Code has already adopted
- Word completion is more granular and flexible than full command history
Related Issues
- #10016 - Enhanced Vim Mode: Support for Text Objects
- #1204 - Implement more Vim motions and shortcuts
- #8471 - Add Vi/Vim Mode to Prompt Input Area
These issues focus on Vim navigation and editing primitives, while this request addresses insert-mode completion—a complementary feature that completes the Vim editing experience.
Implementation Notes
This feature should:
- Only activate when Vim mode is enabled in settings
- Respect the current insert mode state
- Work seamlessly with multiline prompts
- Handle Shift+Enter for newlines correctly
- Not interfere with existing Tab completion for files/commands
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗