Skip to content

Keyboard Shortcuts

A complete reference for every keyboard shortcut available in Claude Code. Organized by context: terminal/CLI shortcuts, VS Code extension shortcuts, and general text editing.


Before You Start: Platform Notes

Many shortcuts differ between Mac and Windows/Linux. This guide uses:

  • Mac: Cmd for the Command key, Option for the Option/Alt key
  • Windows/Linux: Ctrl for the Control key, Alt for the Alt key

macOS users: Several shortcuts use the Option key as Meta. These require a one-time terminal configuration:

  • iTerm2: Settings → Profiles → Keys → set Left/Right Option key to "Esc+"
  • Terminal.app: Settings → Profiles → Keyboard → check "Use Option as Meta Key"
  • VS Code integrated terminal: Settings → Profiles → Keys → set Option key to "Esc+"

Once configured, Option+B, Option+F, etc. will work as expected.

Press ? inside a Claude Code session to see shortcuts available in your specific environment.


Terminal / CLI Shortcuts

Session Control

ShortcutAction
Ctrl+CCancel the current operation or input
Ctrl+DExit Claude Code (sends end-of-file signal)
Ctrl+LClear the terminal screen (conversation history is preserved)
Ctrl+RSearch through command history (type to filter, Ctrl+R again to cycle older matches)
Esc + EscRewind or summarize (restore code/conversation to a previous point, or summarize from a message)
ShortcutAction
Ctrl+OToggle verbose output (shows detailed tool usage and execution steps)
Ctrl+GOpen current prompt (or plan) in your default text editor
Ctrl+TToggle task list visibility in the terminal status area
Up arrowNavigate to previous command in history
Down arrowNavigate to next command in history
Left / Right arrowsCycle through tabs in permission dialogs and menus

Permission Mode Switching

ShortcutAction
Shift+TabCycle through permission modes (default → auto-accept → plan mode → default)

Background Tasks

ShortcutAction
Ctrl+BBackground the currently running command (tmux users: press twice)
Ctrl+X Ctrl+KKill all background agents (chord sequence: press Ctrl+X, then Ctrl+K)

Model and Thinking

ShortcutAction
Cmd+P (Mac) / Meta+P (Win/Linux)Switch model without clearing your prompt
Cmd+T (Mac) / Meta+T (Win/Linux)Toggle extended thinking on/off (run /terminal-setup first)

Paste

ShortcutAction
Ctrl+VPaste image from clipboard
Cmd+V (iTerm2)Paste image from clipboard (iTerm2 only)
Alt+V (Windows)Paste image from clipboard

Text Editing Shortcuts (Within the Prompt)

These shortcuts work while you are typing in the prompt box — before you send your message.

Line Editing

ShortcutAction
Ctrl+KDelete from cursor to end of line (deleted text is saved for pasting)
Ctrl+UDelete the entire current line (deleted text is saved for pasting)
Ctrl+YPaste the most recently deleted text
Alt+Y (after Ctrl+Y)Cycle through paste history (Mac: requires Option as Meta)

Word Navigation

ShortcutAction
Alt+B (Mac: requires Option as Meta)Move cursor back one word
Alt+F (Mac: requires Option as Meta)Move cursor forward one word

Multiline Input

MethodHow
Quick escape (all terminals)Type \ then press Enter
macOS defaultOption+Enter
iTerm2, WezTerm, Ghostty, KittyShift+Enter (works out of the box)
VS Code, Alacritty, Zed, WarpShift+Enter (run /terminal-setup to enable)
Control sequenceCtrl+J (line feed)

Quick Commands (Prompt Prefixes)

Type these at the start of your prompt to trigger special behavior:

PrefixAction
/Open command menu — shows all available slash commands
!Run a shell command directly without asking Claude (output is added to conversation)
@Trigger file path autocomplete — reference a file in your prompt

Slash Commands (Built-in)

Type / in Claude Code to see all available commands. These are the most commonly used:

CommandWhat it does
/helpShow available commands and shortcuts
/clearClear conversation history and start fresh (previous session is saved and resumable)
/compactCompress conversation history to free up context space
/memoryView all loaded CLAUDE.md and auto-memory files; toggle auto-memory
/permissionsView and manage permission rules (allowlist and denylist)
/resumeOpen a conversation picker to resume a previous session
/renameGive the current session a descriptive name
/initGenerate a CLAUDE.md file for the current project
/configOpen the settings interface
/themeChange the color theme
/vimEnable vim-style editing mode
/add-dirAdd an additional directory for Claude to access in the current session
/agentsList available subagents and create new ones
/mcpManage MCP server connections
/btwAsk a quick side question without adding it to conversation history
/effortSet the reasoning effort level: /effort low, /effort medium, /effort high
/modelSwitch to a different Claude model
/fastToggle fast mode (lower latency, less thorough reasoning)

VS Code Extension Shortcuts

These shortcuts work inside the VS Code Claude Code extension panel.

Opening Claude

ShortcutAction
Click spark icon (editor top-right)Open Claude panel (requires a file to be open)
Click spark icon (Activity Bar)Open sessions list
Cmd+Shift+P / Ctrl+Shift+P → "Claude Code"Open via Command Palette
Click "✱ Claude Code" in Status BarOpen Claude (always available, even without a file open)
ShortcutAction
Cmd+Esc / Ctrl+EscToggle focus between editor and Claude
Cmd+Shift+Esc / Ctrl+Shift+EscOpen new Claude conversation in editor tab
Cmd+N / Ctrl+NStart new conversation (when Claude is focused)

Working with Files

ShortcutAction
Option+K / Alt+KInsert @-mention reference for current file and selection into prompt
Shift + drag file into promptAdd file as attachment
Cmd+click / Ctrl+click on image referenceOpen image in default viewer

Sending Messages

SettingDefaultAlternative
Send messageEnterEnable useCtrlEnterToSend setting to use Ctrl+Enter instead
New line in promptShift+Enter

Checkpoints (VS Code Only)

ActionHow
Reveal rewind buttonHover over any message
Fork conversation from this pointClick rewind → "Fork conversation from here"
Revert file changes to this pointClick rewind → "Rewind code to here"
Fork and revertClick rewind → "Fork conversation and rewind code"

Vim Mode Shortcuts

Enable vim mode with /vim or in /config. These shortcuts are available in NORMAL mode.

Mode Switching

KeyAction
EscEnter NORMAL mode
iInsert before cursor
IInsert at beginning of line
aInsert after cursor
AInsert at end of line
oOpen new line below
OOpen new line above

NORMAL Mode Navigation

KeyAction
h / j / k / lLeft / down / up / right
wNext word
bPrevious word
eEnd of word
0Beginning of line
$End of line
ggBeginning of input
GEnd of input
f{char}Jump to next occurrence of character

NORMAL Mode Editing

KeyAction
xDelete character
ddDelete line
ccChange line
yyCopy (yank) line
pPaste after cursor
PPaste before cursor
.Repeat last change
>>Indent line
<<Dedent line

Session Picker Shortcuts

When the session picker is open (from claude --resume or /resume):

KeyAction
/ Navigate between sessions
/ Expand or collapse grouped sessions
EnterResume highlighted session
PPreview session content
RRename highlighted session
/Search/filter sessions
AToggle between current directory and all projects
BFilter to sessions from current git branch
EscExit picker or cancel search

CLI Flags That Function Like Shortcuts

These command-line flags change Claude Code's behavior when starting a session:

FlagEffect
claude -cContinue the most recent conversation
claude -rOpen session picker (or claude -r name to resume by name)
claude -n nameStart session with a custom name
claude --permission-mode planStart in plan mode
claude --permission-mode acceptEditsStart in auto-accept mode
claude -vPrint Claude Code version number
claude updateUpdate Claude Code to the latest version

Press ? in any Claude Code session to see shortcuts specific to your current terminal and platform configuration.

Released under CC BY-SA 4.0.