Skip to content

Keyboard shortcuts for coding agents decide how fast a developer can stop, rewind, plan and inspect agent work. In Claude Code 2.1.283 and the Codex CLI 0.157.1, Esc interrupts, Shift+Tab cycles modes and Ctrl+J inserts a newline. Cursor’s help lists its AI shortcuts (checked 2026-10-12), but they have moved across 3.x builds, so confirm them in the editor itself.

This reference is for developers who drive agents from the keyboard. The agent starts rewriting the wrong module, you press Ctrl+C out of habit, and the session exits instead of stopping. Or you press Shift+Enter inside tmux to add a second line and the half-written prompt goes to the agent. Every shortcut below was checked on 2026-09-26: Claude Code against its interactive-mode and keybindings docs for v2.1.283, and Codex against the rust-v0.157.1 source of its terminal UI. Entries that name a later version or a Cursor page were checked on 2026-10-12: Claude Code 2.1.296’s docs and changelog, Codex 0.162.1’s release notes and config schema, and Cursor’s help.

  • The ten keys per tool that matter daily, side by side.
  • The keys that keep you in control of verification: interrupt, rewind, plan first, and open the transcript or diff.
  • A remapping recipe for each tool, and a way to prove a new binding works.
  • Two copy-paste prompts: one that writes a Claude Code keybindings file, one that audits your terminal for broken keys.
  • The failures you meet in tmux, WSL and macOS terminals, with the fix for each.

The three tools split along one line. Claude Code and Codex are terminal programs with readline-style editing and very similar keys. Cursor is a VS Code fork, so its AI actions are ordinary VS Code keybindings.

ShortcutAction
EscInterrupt the current response or tool call; Claude keeps the work done so far
Esc EscWith text: clear the draft (saved to history). With an empty prompt: open the rewind menu
Shift+TabCycle permission modes, including Plan mode
Ctrl+J or \ + EnterNew line, in any terminal
Ctrl+OToggle the transcript viewer (tool calls, timestamps, model per message)
Ctrl+RReverse search through prompt history
Ctrl+BSend a running Bash command or agent to the background
Ctrl+VPaste an image (Alt+V on Windows and WSL; Cmd+V in iTerm2)
Ctrl+GEdit the prompt in your external editor
? on an empty promptShow the shortcut help panel

Which keys keep you in control of what the agent does?

Section titled “Which keys keep you in control of what the agent does?”

Speed at the keyboard matters less than how quickly you can stop a wrong turn and check the result. These are the keys that keep the loop verifiable without reading every line the agent writes.

JobClaude CodeCodex CLI
Stop a wrong direction, keep the workEscEsc
Plan before any editShift+Tab to Plan mode, or /planShift+Tab to Plan mode, or /plan
Undo the last turn’s code and conversationEsc Esc on an empty prompt, or /rewindEsc Esc edits the previous message; revert files with git
See every tool call the agent madeCtrl+OCtrl+T
See the changed files/diff/diff (includes untracked files)
Add a correction without interruptingType and press Enter: it queues; Ctrl+Enter or Ctrl+X Ctrl+S sends it nowType and press Tab to queue
Stop background subagentsCtrl+X Ctrl+K, twice within 3 seconds/stop ends background terminals

The keys only make review faster; they do not replace the gate. The proof that a change is correct still comes from the tests, type checks and review agents you run before merging, as described in evidence instead of diffs and the evidence bundle. Use Shift+Tab into Plan mode and the transcript key to confirm the agent is attacking the right problem, then let the checks decide whether it solved it.

ShortcutAction
Ctrl+CInterrupt a running operation. At an idle prompt, the first press clears the input and the second exits. Up on the emptied prompt brings the draft back, pasted text and images included (v2.1.288; it also works after a slash command or a sent message from v2.1.292; both channels on 2026-10-17)
Ctrl+DExit. The first press shows a hint; the second within 800 ms exits. With text in the prompt, deletes the next character
Ctrl+LRedraw the screen. Input and conversation history stay; use it when the display is garbled
Ctrl+TShow or hide Claude’s to-do checklist (not the background-task view; that is /tasks)
Ctrl+SStash the current prompt; press again on an empty prompt to restore it
Ctrl+ZSuspend to your shell (Unix only); fg resumes
Up / Down or Ctrl+P / Ctrl+NMove within a multiline prompt, then through history
TabAccept an autocomplete suggestion
Option+P / Alt+PSwitch model without clearing the prompt
Option+T / Alt+TToggle extended thinking (no effect on Opus 5.5 or the Fable models, which always think)
Option+O / Alt+OToggle fast mode
Ctrl+F in the agents view (claude agents)Find sessions by name with the n: filter; Alt+↑ and Alt+↓ jump between group headers (v2.1.288, both channels on 2026-10-17)

On macOS, the Option shortcuts, except Option+T, need the terminal to send Option as Meta (see the failure modes below).

Claude Code uses readline conventions: Ctrl+A and Ctrl+E jump to the start and end of the line, Ctrl+K and Ctrl+U delete to the end or start, Ctrl+W deletes back to the previous whitespace (a whole path in one press), Ctrl+Y pastes what you deleted, and Ctrl+_ undoes the last edit. Alt+B, Alt+F and Alt+D move and delete by word.

PrefixAction
/ at the startCommand or skill menu; type letters to filter
! at the startShell mode: runs the command and adds its output to the session
@File path autocomplete
? on an empty promptShortcut help panel

To edit CLAUDE.md, run /memory. The command reference lists every slash command: see the command reference cheatsheet.

Turn it on in /config under Editor mode, or set "editorMode": "vim" in ~/.claude/settings.json (the old /vim command was removed in v2.1.92). Esc then switches to NORMAL mode instead of interrupting, so use Ctrl+C to stop a running turn. NORMAL mode supports the usual motions (hjkl, w/b/e, 0/$, gg/G, f{char}), operators (d, c, y with text objects such as iw or i"), visual mode (v, V), u and ..

Shortcut or prefixAction
Ctrl+CWith text in the composer, clear the draft (it stays in history). With an empty composer, interrupt a running turn, or quit when idle
Ctrl+DQuit, when the composer is empty
Ctrl+VPaste an image from the clipboard (Ctrl+Alt+V also works)
F4Focus the activity pane
F8Toggle voice input
@Mention a file (the menu also lists plugins and skills)
! at the startShell mode: run a command directly
/ at the startSlash command menu, for example /model, /plan, /diff, /review, /compact, /new

Pasting an image file path also attaches it. /vim toggles Vim mode for the composer. Codex 0.158.0 added copy-on-select and right-click paste to the fullscreen TUI. tui.copy_on_select (auto, always or never) and tui.right_click_paste (auto, on or off) control them: right-click paste is on by default on Windows, WSL and Linux, and on also enables macOS. tui.mouse_scroll_speed (0.162.0) scales the mouse wheel, and the 0.162.0 release notes also name Ctrl+Insert and /copy (config schema and release notes, checked 2026-10-12). For the full command list, see Codex CLI commands. The Codex desktop app (codex app, macOS and Windows) has its own shortcut set, which this page does not cover.

  1. Run /keybindings. It creates or opens ~/.claude/keybindings.json.

  2. Add a block per context. This example makes Enter insert a newline and Shift+Enter send, which suits people who paste long multi-line prompts:

    {
    "$schema": "https://www.schemastore.org/claude-code-keybindings.json",
    "bindings": [
    {
    "context": "Chat",
    "bindings": {
    "enter": "chat:newline",
    "shift+enter": "chat:submit"
    }
    }
    ]
    }
  3. Save. Claude Code applies the change without a restart. Set an action to null to unbind a key.

Ctrl+C, Ctrl+D, Ctrl+M, Ctrl+[, Ctrl+I and Ctrl+H are reserved and cannot be rebound. Vim keys are not remappable here; the vimInsertModeRemaps setting in your user settings maps a two-key sequence such as jj to Esc, and Claude Code ignores that setting in a project’s .claude/settings.json, so a cloned repository cannot remap your keys.

The /effort slider’s keys became rebindable in v2.1.284: effortSlider:decreaseEffort (Left), effortSlider:increaseEffort (Right) and effortSlider:toggleUltracode (Tab). Enter and Escape in the slider can’t be rebound. In the agents view, agents:find (Ctrl+F) can be rebound from v2.1.288 (both channels on 2026-10-17).

Do not trust a binding because the file saved. Three checks confirm it in under a minute:

  1. Press ? on an empty prompt. Claude Code’s help panel and Codex’s overlay show the keys actually in effect.

  2. Start Claude Code with claude --debug. It writes a warning to the debug log for invalid JSON, a misspelled modifier, an unknown context or action, a reserved key and a duplicate binding.

  3. Press the key on a throwaway prompt such as echo test before you rely on it in a real session, and confirm it did what the table says.

What breaks with agent shortcuts, and how do you recover?

Section titled “What breaks with agent shortcuts, and how do you recover?”
SymptomCauseFix
Shift+Enter sends the prompt inside tmuxtmux does not pass extended keys by defaultAdd set -s extended-keys on and set -as terminal-features 'xterm*:extkeys' to ~/.tmux.conf, then run tmux source-file ~/.tmux.conf. Until then, use Ctrl+J
Shift+Enter sends in the VS Code or Cursor integrated terminalThe terminal needs a keybindingRun /terminal-setup once in Claude Code, from the host terminal, not inside tmux
Option+P or Option+Enter does nothing on macOSThe terminal does not send Option as MetaApple Terminal: Settings, Profiles, Keyboard, “Use Option as Meta Key”. iTerm2: set both Option keys to “Esc+”. VS Code: "terminal.integrated.macOptionIsMeta": true
Ctrl+B does nothing in tmuxIt is the tmux prefixPress it twice in Claude Code, or use the default Ctrl+X Ctrl+B chord
Image paste fails on WSLThe terminal intercepts Ctrl+VUse Alt+V
Esc no longer stops ClaudeVim mode is on, so Esc enters NORMAL modePress Ctrl+C to interrupt
A key you bound fires a bare letterA misspelled modifier (ctl+k) is dropped and binds kFix the spelling; claude --debug shows the warning
You sent a half-written prompt and the agent started editingEnter submittedPress Esc at once, then Esc Esc on the empty prompt to rewind in Claude Code, or Esc Esc to edit the previous message in Codex. Check git status before continuing
Ctrl+C quit the sessionAt an idle prompt, Claude Code exits on the second press, and Codex exits on the first press once the composer is emptyResume with claude --continue or codex resume --last, and use Esc to stop turns from now on

For session recovery beyond the keyboard, see error recovery in Claude Code and error recovery in Codex.

Where to go next from the shortcut reference

Section titled “Where to go next from the shortcut reference”

Frequently asked questions

How do you stop Claude Code mid-response without losing the session?

Press Esc. It interrupts the current response or tool call and keeps the work done so far. Ctrl+C also interrupts a running operation, but at an idle prompt it clears the input and a second press exits Claude Code.

What does pressing Esc twice do in Claude Code?

With text in the prompt, double Esc clears it and saves the draft to history. With an empty prompt, it opens the rewind menu, which restores code and conversation from an earlier checkpoint.

How do you insert a new line in Claude Code or Codex without sending?

Ctrl+J works in both tools in any terminal, and \ then Enter works in Claude Code. Shift+Enter works natively in terminals such as iTerm2, Ghostty, Kitty, WezTerm and Windows Terminal; in the VS Code or Cursor integrated terminal, run /terminal-setup once. Inside tmux it needs extended-keys turned on.

How do you remap shortcuts in Claude Code and Codex?

In Claude Code, run /keybindings to open ~/.claude/keybindings.json and map keys to actions such as chat:newline; changes apply without a restart. In the Codex CLI, run /keymap or add bindings under [tui.keymap.<context>] in ~/.codex/config.toml.

Where are Cursor's current keyboard shortcuts listed?

Cursor's help lists them: Cmd+I or Cmd+L toggles the side panel, Cmd+K is inline edit, Cmd+. opens the mode menu and Shift+Tab rotates Agent modes (checked 2026-10-12). Defaults have moved across the Cursor 3.x line, so confirm each AI action in the Keyboard Shortcuts editor of your own build and pin the ones you rely on in keybindings.json.