Keyboard shortcuts for Claude Code, Codex and Cursor
PLKeyboard 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.
What this shortcut reference gives you
Section titled “What this shortcut reference gives you”- 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.
Which shortcuts matter most in each tool?
Section titled “Which shortcuts matter most in each tool?”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.
| Shortcut | Action |
|---|---|
Esc | Interrupt the current response or tool call; Claude keeps the work done so far |
Esc Esc | With text: clear the draft (saved to history). With an empty prompt: open the rewind menu |
Shift+Tab | Cycle permission modes, including Plan mode |
Ctrl+J or \ + Enter | New line, in any terminal |
Ctrl+O | Toggle the transcript viewer (tool calls, timestamps, model per message) |
Ctrl+R | Reverse search through prompt history |
Ctrl+B | Send a running Bash command or agent to the background |
Ctrl+V | Paste an image (Alt+V on Windows and WSL; Cmd+V in iTerm2) |
Ctrl+G | Edit the prompt in your external editor |
? on an empty prompt | Show the shortcut help panel |
| Shortcut | Action |
|---|---|
Esc | Interrupt a running turn (the status line reads “esc to interrupt”) |
Esc Esc | Edit the previous message |
Shift+Tab | Cycle modes (Plan mode is one of them) |
Ctrl+J | New line, in any terminal |
Ctrl+T | Show the transcript; F3 searches it |
Ctrl+R | Search prompt history |
Tab | While a turn runs, queue the message you are typing |
Alt+, / Alt+. | Lower or raise reasoning effort |
Ctrl+G | Edit the prompt in your external editor |
? | Show the shortcut overlay |
Cursor’s AI shortcuts (inline edit, the Agent panel, add selection to chat, accept or reject changes) are VS Code keybindings. Cursor’s keyboard-shortcuts help page (checked 2026-10-12) lists these, spelled with the macOS Cmd key:
| Shortcut | Action |
|---|---|
Cmd+I or Cmd+L | Toggle the side panel; Cursor’s help gives Ctrl+I for the Agent panel on Windows and Linux |
Cmd+K | Inline edit |
Cmd+. | Open the mode menu |
Shift+Tab | Rotate through the Agent modes: Agent, Ask, Plan and Debug. Each mode uses its own context, so switching starts a fresh context window |
Cmd+/ | “Loop between AI models” |
Cursor’s help lists no Windows or Linux key for the last four rows, and the defaults have moved across the Cursor 3.x line. In Cursor 3.24 (2026-10-09) the Goal, queue, debug, canvas and browser panels open from pills above the prompt (Cursor’s release notes).
Confirm every key in your own build: open the Command Palette (Cmd+Shift+P on macOS, Ctrl+Shift+P on Windows and Linux), run Preferences: Open Keyboard Shortcuts, and search for the action. The Cursor keyboard shortcuts page has the worksheet of actions to confirm and the keybindings.json pattern that pins them so an update cannot move them.
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.
| Job | Claude Code | Codex CLI |
|---|---|---|
| Stop a wrong direction, keep the work | Esc | Esc |
| Plan before any edit | Shift+Tab to Plan mode, or /plan | Shift+Tab to Plan mode, or /plan |
| Undo the last turn’s code and conversation | Esc Esc on an empty prompt, or /rewind | Esc Esc edits the previous message; revert files with git |
| See every tool call the agent made | Ctrl+O | Ctrl+T |
| See the changed files | /diff | /diff (includes untracked files) |
| Add a correction without interrupting | Type and press Enter: it queues; Ctrl+Enter or Ctrl+X Ctrl+S sends it now | Type and press Tab to queue |
| Stop background subagents | Ctrl+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.
Claude Code shortcuts in full (v2.1.283)
Section titled “Claude Code shortcuts in full (v2.1.283)”Session and control keys
Section titled “Session and control keys”| Shortcut | Action |
|---|---|
Ctrl+C | Interrupt 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+D | Exit. The first press shows a hint; the second within 800 ms exits. With text in the prompt, deletes the next character |
Ctrl+L | Redraw the screen. Input and conversation history stay; use it when the display is garbled |
Ctrl+T | Show or hide Claude’s to-do checklist (not the background-task view; that is /tasks) |
Ctrl+S | Stash the current prompt; press again on an empty prompt to restore it |
Ctrl+Z | Suspend to your shell (Unix only); fg resumes |
Up / Down or Ctrl+P / Ctrl+N | Move within a multiline prompt, then through history |
Tab | Accept an autocomplete suggestion |
Option+P / Alt+P | Switch model without clearing the prompt |
Option+T / Alt+T | Toggle extended thinking (no effect on Opus 5.5 or the Fable models, which always think) |
Option+O / Alt+O | Toggle 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).
Text editing keys
Section titled “Text editing keys”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.
Prefixes typed at the prompt
Section titled “Prefixes typed at the prompt”| Prefix | Action |
|---|---|
/ at the start | Command or skill menu; type letters to filter |
! at the start | Shell mode: runs the command and adds its output to the session |
@ | File path autocomplete |
? on an empty prompt | Shortcut help panel |
To edit CLAUDE.md, run /memory. The command reference lists every slash command: see the command reference cheatsheet.
Vim mode
Section titled “Vim mode”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 ..
Codex CLI shortcuts in full (0.157.1)
Section titled “Codex CLI shortcuts in full (0.157.1)”| Shortcut or prefix | Action |
|---|---|
Ctrl+C | With text in the composer, clear the draft (it stays in history). With an empty composer, interrupt a running turn, or quit when idle |
Ctrl+D | Quit, when the composer is empty |
Ctrl+V | Paste an image from the clipboard (Ctrl+Alt+V also works) |
F4 | Focus the activity pane |
F8 | Toggle voice input |
@ | Mention a file (the menu also lists plugins and skills) |
! at the start | Shell mode: run a command directly |
/ at the start | Slash 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.
How do you remap agent shortcuts?
Section titled “How do you remap agent shortcuts?”-
Run
/keybindings. It creates or opens~/.claude/keybindings.json. -
Add a block per context. This example makes
Enterinsert a newline andShift+Entersend, 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"}}]} -
Save. Claude Code applies the change without a restart. Set an action to
nullto 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).
Run /keymap in the Codex CLI to remap its TUI shortcuts interactively, or write the bindings yourself in ~/.codex/config.toml, one table per context. A value is one key or a list of keys, written as ctrl-a, shift-enter or f9. This example keeps Tab for queueing a message, adds Ctrl+Q as a second key, and moves voice input from F8 to F9:
[tui.keymap.composer]queue = ["tab", "ctrl-q"]
[tui.keymap.chat]toggle_voice = "f9"Some keys belong to fixed actions and cannot be rebound: Ctrl+C, Ctrl+D, Ctrl+V, Ctrl+Alt+V, Shift+Tab, Esc, Alt+Left, Alt+Right, and /, !, @ and $. Binding one of them fails at startup with an Ambiguous tui.keymap error (checked on 0.157.1). /vim toggles Vim mode for the composer. Press ? afterwards: the overlay shows the bindings in effect.
Open Preferences: Open Keyboard Shortcuts from the Command Palette, search for the action, and record a new key. Pin the bindings you depend on in keybindings.json, as the Cursor keyboard shortcuts page shows, so the next Cursor update cannot move them.
How do you prove a new binding works?
Section titled “How do you prove a new binding works?”Do not trust a binding because the file saved. Three checks confirm it in under a minute:
-
Press
?on an empty prompt. Claude Code’s help panel and Codex’s overlay show the keys actually in effect. -
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. -
Press the key on a throwaway prompt such as
echo testbefore 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?”| Symptom | Cause | Fix |
|---|---|---|
Shift+Enter sends the prompt inside tmux | tmux does not pass extended keys by default | Add 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 terminal | The terminal needs a keybinding | Run /terminal-setup once in Claude Code, from the host terminal, not inside tmux |
Option+P or Option+Enter does nothing on macOS | The terminal does not send Option as Meta | Apple 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 tmux | It is the tmux prefix | Press it twice in Claude Code, or use the default Ctrl+X Ctrl+B chord |
| Image paste fails on WSL | The terminal intercepts Ctrl+V | Use Alt+V |
Esc no longer stops Claude | Vim mode is on, so Esc enters NORMAL mode | Press Ctrl+C to interrupt |
| A key you bound fires a bare letter | A misspelled modifier (ctl+k) is dropped and binds k | Fix the spelling; claude --debug shows the warning |
| You sent a half-written prompt and the agent started editing | Enter submitted | Press 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 session | At an idle prompt, Claude Code exits on the second press, and Codex exits on the first press once the composer is empty | Resume 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”- Terminal mastery for Claude Code: tmux, panes and long sessions in the terminal.
- Command reference cheatsheet: the slash commands and CLI flags for all three tools.
- Configuration reference: where each tool keeps its settings files.
- Permissions and sandboxing: what the modes you cycle with
Shift+Tabactually allow.
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.