Back to Blog

Claude Code keyboard shortcuts: the ones worth learning, vim mode, and your own

Alex Kim
7 min read
Claude Code keyboard shortcuts: the ones worth learning, vim mode, and your own

Last updated: November 27, 2026

TL;DR

You don't need all of Claude Code's shortcuts. You need about a dozen, and they fall into four groups: the keys that steer a turn while Claude is working (Esc, Ctrl+B, Shift+Tab), the keys that edit your prompt (Ctrl+R, Ctrl+G, Ctrl+S), the ways to write more than one line (Ctrl+J works everywhere), and the two ways to make the keyboard yours: vim mode from /config, and your own bindings in ~/.claude/keybindings.json. Press ? on an empty prompt to see the list in the app. Everything below comes from Anthropic's interactive mode reference and its keybindings page. For the commands and flags around them, start with our Claude Code CLI guide.

Steer a turn while Claude works

These are the keys that save a session when the agent heads the wrong way.

ShortcutWhat it does
EscStops the current response or tool call mid-turn. Claude keeps the work done so far, so you can redirect it
Esc EscWith text in the prompt, clears it and saves the draft to history. With the prompt empty, opens the rewind menu
Ctrl+CInterrupts a running operation. With nothing running, the first press clears the input and a second press exits
Ctrl+BSends a running Bash command or agent to the background. In tmux, press it twice
Shift+TabCycles permission modes: default (shown as Manual), acceptEdits and plan, then bypassPermissions and auto where available
Ctrl+OOpens the transcript viewer, with each tool call in detail
Ctrl+TShows or hides Claude's to-do checklist
Option+P / Alt+PSwitches model without clearing your prompt

Esc is the one to learn first. It interrupts without throwing away what's done, which makes it the cheapest fix when Claude starts on the wrong file. If the edits are already made, the rewind menu behind a double Esc restores code, conversation or both; our rewind guide covers it. The permission modes behind Shift+Tab are in our permissions guide.

You can also type while Claude works. Pressing Enter mid-turn queues your message instead of interrupting, and Ctrl+X Ctrl+S sends the queue right away.

Edit the prompt without retyping it

ShortcutWhat it does
Ctrl+RSearches your earlier prompts
Up / DownMoves through history once the cursor is on the first or last row
Ctrl+GOpens the prompt in your default text editor
Ctrl+SStashes the prompt and clears it; press again on an empty prompt to bring it back
Ctrl+_Undoes the last edit to your input
Ctrl+A / Ctrl+EJumps to the start or end of the line
Ctrl+WDeletes back to the previous space, so one press removes a whole path
Ctrl+K / Ctrl+UDeletes to the end or the start of the line
Ctrl+YPastes back what you just deleted

Ctrl+S earns its place when you're halfway through a long prompt and need to ask something else first. Ctrl+G is the one for prompts too long for one line of terminal. Since Claude Code v2.1.314, Ctrl+R also finds a prompt from a word in something long you pasted into it, such as an error log.

On macOS, the Alt word shortcuts (Alt+B, Alt+F, Alt+D, Alt+Y, Alt+P) need Option set as Meta in your terminal. Anthropic's terminal setup page gives the setting for each terminal. Option+T, which toggles extended thinking, works without it.

Write more than one line

Plain Enter sends the message. To add a line instead:

MethodWhere it works
Ctrl+JAny terminal, no setup
\ then EnterAny terminal
Shift+EnterNatively in iTerm2, WezTerm, Ghostty, Kitty, Warp and Windows Terminal 1.25 or later
Option+EntermacOS, once Option is set as Meta

Pasting a code block or a log also works as is. Three prefixes round this out: / at the start opens commands and skills, ! at the start runs a shell command and adds its output to the session, and @ autocompletes a file path. Our slash commands guide covers the first.

Turn on vim mode

Open /config and set Editor mode to vim. Or put it in ~/.claude/settings.json, where you can also map a two-key sequence such as jj to Escape:

{
  "editorMode": "vim",
  "vimInsertModeRemaps": { "jj": "<Esc>" }
}

Anthropic's docs set two limits on that remap: each key is "exactly two printable characters", and "<Esc>" is the only supported target. Claude Code reads it from your user settings, a settings file passed on the command line and managed settings only, so a project's .claude/settings.json can't remap your keys.

What vim mode gives you:

  • Modes. Esc enters NORMAL mode; i, I, a, A, o and O go back to INSERT; v and V start a visual selection.
  • Motions and edits. h, j, k and l move; dw, cw and yy delete, change and yank; text objects such as iw, i" and i( work too.
  • Two keys that change meaning. In NORMAL mode, / opens history search, the same as Ctrl+R, and ? shows the help menu.

Vim mode and keybindings run side by side. The keybindings page says vim mode "handles input at the text input level" and keybindings "handle actions at the component level", so most Ctrl shortcuts still work in vim mode. One difference to expect: in vim mode, Esc switches INSERT to NORMAL instead of cancelling your input.

Rebind keys with keybindings.json

Run /keybindings. It creates or opens ~/.claude/keybindings.json, and Claude Code picks up changes without a restart. Each block names a context and maps keys to actions. This example, adapted from Anthropic's docs, binds Ctrl+E to the external editor and unbinds Ctrl+S:

{
  "bindings": [
    {
      "context": "Chat",
      "bindings": {
        "ctrl+e": "chat:externalEditor",
        "ctrl+s": null
      }
    }
  ]
}

A few rules from the same page:

  • Actions use namespace:action names, such as chat:submit or app:toggleTodos. A command:<name> action runs a command: "meta+g": "command:compact" makes Meta+G run /compact.
  • null unbinds a default. That's how you free a key for something else.
  • Some keys are reserved: Ctrl+C, Ctrl+D and Ctrl+M, among others, can't be rebound.
  • Vim keys aren't remappable here. Use vimInsertModeRemaps for the Escape sequence.
  • Mistakes are logged, not shown. Start Claude Code with its debug flag to see warnings for a misspelled modifier, an unknown action or a duplicate binding.

Watch for clashes with your terminal tools: Ctrl+B is the tmux prefix and Ctrl+A is GNU screen's.

Frequently asked questions

How do I see all Claude Code keyboard shortcuts?

Press ? on an empty prompt to toggle the shortcut help panel. Shortcuts vary by platform and terminal, so the panel shows what applies to yours. Anthropic's interactive mode page has the full reference.

How do I stop Claude Code mid-response?

Press Esc. It stops the current response or tool call and keeps the work done so far, so you can redirect. Ctrl+C also interrupts a running operation; with nothing running, pressing it twice exits.

How do I add a new line in Claude Code without sending?

Press Ctrl+J, which works in any terminal, or type \ and then Enter. Shift+Enter works natively in iTerm2, WezTerm, Ghostty, Kitty, Warp and recent Windows Terminal.

How do I turn on vim mode in Claude Code?

Open /config and set Editor mode to vim, or add "editorMode": "vim" to ~/.claude/settings.json. Add vimInsertModeRemaps with { "jj": "<Esc>" } to leave INSERT mode with jj.

Can I change Claude Code's keyboard shortcuts?

Yes. Run /keybindings to open ~/.claude/keybindings.json, then map keys to actions per context, or set an action to null to unbind it. Ctrl+C, Ctrl+D and a few other keys are reserved and can't be rebound.

#claude-code#Keyboard Shortcuts#Vim Mode#Keybindings#Terminal
Free assessment

Stop guessing. Score your first workflow.

Score one workflow in about five minutes. Nine questions, a grade, and the specific gap holding it back - no call required.