Claude Code /vim: Vim Keybindings in Your AI Coding Assistant
What Is /vim
If you’re a Vim user, your fingers have already built muscle memory — hjkl to move the cursor, dd to delete a line, ciw to replace a word, Esc to return to NORMAL mode.
In Claude Code’s input box, the default is standard readline keybindings. Every time you want to move the cursor, you reach for the arrow keys. Deleting a word means hitting backspace repeatedly — for Vim users, this is painful.
/vim turns Claude Code’s input box into a mini Vim editor. Type normally in INSERT mode, press Esc to switch to NORMAL mode and use Vim keybindings to manipulate text.
How to Use It
/vim
A simple toggle. Type it once to enable Vim mode, type it again to disable.
When enabled, you’ll see:
Editor mode set to vim. Use Escape key to toggle between INSERT and NORMAL modes.
This setting is global and persists in your config — Vim mode remains active the next time you start Claude Code.
Two Modes
INSERT Mode
- Works just like normal input — typing goes directly into the text box
- Bottom-left of the input box shows
-- INSERT -- - Press Esc to switch to NORMAL mode
NORMAL Mode
- Keystrokes don’t enter text — they execute Vim commands
- The
-- INSERT --indicator disappears - Press i / a / o to return to INSERT mode
- Press Enter to send the current content (same as normal mode)
It starts in INSERT mode by default, so you can start typing immediately.
Supported Vim Keybindings
Movement
| Key | Action |
|---|---|
h / l | Move left / right one character |
j / k | Move down / up one line (logical) |
gj / gk | Move down / up one line (display) |
w / b | Next / previous word start |
e | End of current word |
W / B / E | Same but whitespace-delimited (WORD) |
0 | Start of line |
^ | First non-blank character of line |
$ | End of line |
gg | Start of text (or line N) |
G | End of text (or line N) |
| Arrow keys | Mapped to hjkl in NORMAL mode |
Find
| Key | Action |
|---|---|
f{char} | Find char forward (cursor on char) |
F{char} | Find char backward |
t{char} | Find char forward (cursor before char) |
T{char} | Find char backward (cursor after char) |
; | Repeat last find |
, | Repeat last find (reversed) |
Operators
Operators compose with motions, text objects, and count prefixes — this is Vim’s “grammar”:
| Key | Action |
|---|---|
d | Delete |
c | Change (delete + enter INSERT) |
y | Yank (copy) |
Composition examples:
dw— delete to next wordd2w— delete to the 2nd word aheadc$— change from cursor to end of lineyy— yank entire line3dd— delete 3 lines
Line Operations
| Key | Action |
|---|---|
dd | Delete entire line |
cc | Change entire line |
yy | Yank entire line |
D | Delete to end of line (= d$) |
C | Change to end of line (= c$) |
Y | Yank entire line |
>> | Indent (2 spaces) |
<< | Dedent |
J | Join lines |
Character Operations
| Key | Action |
|---|---|
x | Delete character under cursor |
r{char} | Replace character under cursor |
~ | Toggle case |
Text Objects
Text objects are used after an operator. i means “inner”, a means “including boundaries”:
| Key | Scope |
|---|---|
iw / aw | Word |
iW / aW | WORD (whitespace-delimited) |
i" / a" | Inside double quotes |
i' / a' | Inside single quotes |
i` / a` | Inside backticks |
i( / a( | Inside parentheses |
i[ / a[ | Inside square brackets |
i{ / a{ | Inside curly braces |
i< / a< | Inside angle brackets |
Composition examples:
ciw— change entire worddi"— delete contents inside double quotesda(— delete parentheses and their contentsyi{— yank contents inside curly braces
Mode Switching
| Key | Action |
|---|---|
i | Insert before cursor |
I | Insert at first non-blank of line |
a | Insert after cursor |
A | Insert at end of line |
o | Open line below + INSERT |
O | Open line above + INSERT |
Esc | Return to NORMAL mode |
Other
| Key | Action |
|---|---|
p | Paste after (linewise-aware) |
P | Paste before |
. | Dot-repeat last change |
u | Undo |
? | Help shortcut (in NORMAL idle) |
1-9 | Count prefix, repeat following action |
Unsupported Vim Features
To keep things practical for a terminal input box, these Vim features are not implemented:
/and?search (limited value in an input box)- Visual mode (
v/V/ Ctrl-V) - Macro recording (
q) - Marks (
m) - Named registers (
") - Ex commands (
:) %bracket matching*/#word search- Ctrl-R redo
- Ctrl-U / Ctrl-D half-page scroll
These are useful in a full Vim editor but aren’t essential in Claude Code’s input box context.
Scope
Vim mode only affects the input box. Specifically:
- Claude’s response output, tool call results, conversation history display, and all other UI elements are completely unaffected
- You cannot use Vim keybindings to scroll through conversation history or select output text
- Ctrl combinations (Ctrl+C, Ctrl+D, etc.) work normally in both modes
- Enter in NORMAL mode still sends the message
Practical Tips
Tip 1: Vim Shines with Multi-Line Input
When you need to type a longer prompt, especially multi-line content, Vim mode really shines. o to open a new line, dd to remove an unwanted line, ciw to quickly replace a word — much more efficient than arrow keys and backspace.
Tip 2: Dot-Repeat Is the Killer Feature
The . key repeats the last change operation. For example, use ciw to change a variable name, move to the next occurrence and press . to instantly perform the same replacement. Incredibly useful when writing complex prompts.
Tip 3: Text Objects for Quotes and Brackets
When writing prompts, you often need to modify content inside quotes or brackets. ci" to clear double-quoted content and enter INSERT mode, da( to delete parentheses and their contents — these text object operations are especially handy when editing JSON examples or code snippets.
Tip 4: Count Prefix for Bulk Operations
3dd to delete 3 lines, 5j to move down 5 lines — count prefixes let you skip step-by-step operations and jump straight to your target. The count limit is 10000, so no worries about accidentally freezing with a huge number.
Tip 5: Turn It Off Anytime
If you find Vim mode isn’t for you, or want to switch back to normal mode in certain situations, just type /vim again to disable it. The setting persists, but toggling is instant.
Final Thoughts
/vim isn’t a “feature” — it’s a form of respect. Respect for the editing habits you’ve built over the years.
For non-Vim users, this command may hold zero appeal. But for Vim users, being able to use familiar hjkl, ciw, dd, . to edit prompts in Claude Code feels as natural as being in your own editor.
Muscle memory doesn’t need retraining. Tools should adapt to you, not the other way around.
More Articles
- Why AI-First Startups Only Need One Programming Language
- cc-ping: Ping All Your Claude Code Configs in One Command
- Shocking! This Tool Lets Programmers Finish 95 Minutes of Work in 4 Minutes! 24x Efficiency Boost
- CCBot - 24x Development Efficiency Boost
- Claude Code /add-dir: The Monorepo Command You Miss
- Claude Code Token-Saving Tip: The Power of the Exclamation Mark
- I Built a Bot That Runs Claude Code From Chat
- Claude Code /btw Command Explained: Quick Side Questions Without Breaking Flow
- Claude Code /compact: Free Up Context, Keep Progress
- Claude Code /config: Every Setting Explained
- Claude Code /context: What's Eating Your Context Window?
- Claude Code /diff: See Exactly What Changed, Turn by Turn
- Claude Code /fast: Same Opus, 2x Speed — Worth It?
- Best Practice for External Knowledge in Claude Code: GitHub MCP + Context7
- Claude Code /hooks: Make AI Follow Your Rules
- Claude Code /init: Generate CLAUDE.md in 10 Seconds
- Claude Code MCP: Give Your AI Access to Any Tool
- Claude Code /memory Explained: Make AI Truly Remember Your Project
- Claude Code /model: Opus vs Sonnet vs Haiku Guide
- Claude Code /permissions: Fine-Grained Control Over What AI Can Do
- Claude Code /plan Explained: Think Before You Code
- Claude Code + Playwright MCP: AI Can Finally "See" the Page
- Claude Code /resume Command Explained: Don't Let Your Conversations Go to Waste
- Claude Code /review: Let AI Do Your Code Review
- Claude Code Skills Explained: Build Your Custom Command Library
- Claude Code /stats: See How Much AI Does For You
- Claude Code /status Command Explained: Your Session Dashboard
- Claude Code /tasks Command Explained: Master Your Background Tasks
- Claude Code /usage Command Explained: Know Your Remaining Quota
- Claude Code in 2026: The Only Setup Guide You Need
- The Complete Guide to Claude: From Chat to Code to Automation