Skip to main content

Keyboard shortcuts

Keyboard shortcuts may vary by platform and terminal. In fullscreen rendering, press ? in the transcript viewer to see available shortcuts there.macOS users: Option/Alt key shortcuts (Alt+B, Alt+F, Alt+Y, Alt+P) require configuring Option as Meta in your terminal:
  • iTerm2: Settings → Profiles → Keys → General → set Left/Right Option key to “Esc+”
  • Apple Terminal: Settings → Profiles → Keyboard → check “Use Option as Meta Key”
  • VS Code: set "terminal.integrated.macOptionIsMeta": true in VS Code settings
See Terminal configuration for details.

General controls

Text editing

Theme and display

Multiline input

Shift+Enter works without configuration in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal, and Windows Terminal. For VS Code, Cursor, Devin Desktop, Alacritty, and Zed, run /terminal-setup to install the binding.

Quick commands

Transcript viewer

When the transcript viewer is open (toggled with Ctrl+O), these shortcuts are available. Run /tui with no argument to check which renderer is active. In fullscreen rendering, press ? to show the full shortcut reference panel inside the viewer. Ctrl+E can be rebound via transcript:toggleShowAll.

Voice input

Commands

Type / in Claude Code to see all available commands, or type / followed by any letters to filter. The / menu shows everything you can invoke: built-in commands, bundled and user-authored skills, and commands contributed by plugins and MCP servers. Not all built-in commands are visible to every user since some depend on your platform or plan. In fullscreen rendering, the / command and @ file suggestion lists also respond to the mouse: hovering highlights a row and clicking accepts it. See the commands reference for the full list of commands included in Claude Code.

Vim editor mode

Enable vim-style editing via /config → Editor mode.

Mode switching

Remap INSERT-mode key sequences

The vimInsertModeRemaps setting maps a two-key INSERT-mode sequence to Escape, so a mapping like jj returns you to NORMAL mode. Requires Claude Code v2.1.208 or later. The following ~/.claude/settings.json example turns on vim mode and maps jj to Escape:
Each key is exactly two printable characters typed in sequence, and "<Esc>" is the only supported target. Entries with a different length or target are ignored. Typing the first character of a sequence inserts it normally. Pressing the second character within one second removes that pending character and switches to NORMAL mode, leaving neither character in your input. After the one-second window, or if a different key follows, both characters stay as literal text, so you can still type a word containing the sequence by pausing between the two keys. Claude Code reads this setting from your user settings file, the --settings flag, and managed settings only. Entries in a project’s .claude/settings.json or .claude/settings.local.json are ignored, so a checked-out repository can’t remap your keystrokes.
In vim normal mode, if the cursor is at the beginning or end of input and can’t move further, j/k and the arrow keys navigate command history instead.

Editing (NORMAL mode)

Text objects (NORMAL mode)

Text objects work with operators like d, c, and y:

Visual mode

Press v for character-wise selection or V for line-wise selection. Motions extend the selection, and operators act on it directly. Block-wise visual mode with Ctrl+V is not supported.

Command history

Claude Code maintains command history for the current session:
  • Input history is stored per working directory
  • Input history resets when you run /clear to start a new session. The previous session’s conversation is preserved and can be resumed.
  • Submitting the same prompt twice in a row records one history entry, so pressing Up steps to the previous distinct prompt
  • Use Up/Down arrows to navigate (see keyboard shortcuts above)
  • History expansion with ! is disabled by default

Reverse search with Ctrl+R

Press Ctrl+R to interactively search through your command history. In fullscreen rendering, Ctrl+R opens a search dialog instead: type to filter, press Up and Down to move through matches, and press Ctrl+S to cycle the scope through this session, this project, and all projects. Press Enter or Tab to place a match in the prompt input, or Esc to cancel. The steps below describe the default inline search:
  1. Start search: press Ctrl+R to activate reverse history search
  2. Type query: enter text to search for in previous commands. The search term is highlighted in matching results
  3. Navigate matches: press Ctrl+R again to cycle through older matches
  4. Search scope: the inline search always searches prompts from all projects
  5. Accept match:
    • Press Tab or Esc to accept the current match and continue editing
    • Press Enter to accept and execute the command immediately
  6. Cancel search:
    • Press Ctrl+C to cancel and restore your original input
    • Press Backspace on empty search to cancel
The inline search scans your full prompt history, newest first, with duplicates collapsed to the newest occurrence. The fullscreen dialog lists the 100 most recent unique prompts in the selected scope. Matching prompts display with the search term highlighted, so you can find and reuse previous inputs. Accepting a match or canceling the search takes effect immediately, even while Claude Code is still loading the history. Before v2.1.202, accepting or canceling during that load could report an internal error.

Background Bash commands

Claude Code supports running Bash commands in the background, allowing you to continue working while long-running processes execute.

How backgrounding works

When Claude Code runs a command in the background, it runs the command asynchronously and immediately returns a background task ID. Claude Code can respond to new prompts while the command continues executing in the background. To run commands in the background, you can either:
  • Prompt Claude Code to run a command in the background
  • Press Ctrl+B to move a regular Bash tool invocation to the background. Tmux users must press Ctrl+B twice due to tmux’s prefix key.
Key features:
  • Output is written to a file and Claude can retrieve it using the Read tool
  • Background tasks have unique IDs for tracking and output retrieval
  • Background tasks are automatically cleaned up when Claude Code exits. Backgrounding the session instead of exiting it hands them to the background session, where they keep running. See background a running session
  • Background tasks are automatically terminated if output exceeds 5GB, with a note in stderr explaining why
  • As of v2.1.193, on macOS and Linux, running background tasks are terminated when the operating system signals memory pressure, provided the session has been idle for at least 30 minutes with no turn or subagent running. Set CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP to 1 to turn this off
To disable all background task functionality, set the CLAUDE_CODE_DISABLE_BACKGROUND_TASKS environment variable to 1. See Environment variables for details. Common backgrounded commands:
  • Build tools (webpack, vite, make)
  • Package managers (npm, yarn, pnpm)
  • Test runners (jest, pytest)
  • Development servers
  • Long-running processes (docker, terraform)

Shell mode with ! prefix

Run shell commands directly without going through Claude by prefixing your input with !:
Shell mode:
  • Adds the command and its output to the conversation context
  • Shows real-time progress and output
  • Supports the same Ctrl+B backgrounding for long-running commands
  • Doesn’t require Claude to interpret or approve the command
  • Supports history-based autocomplete: type a partial command and press Tab to complete from previous ! commands in the current project
  • Supports live file path autocomplete as of v2.1.193 on all platforms: type a token containing a forward slash, such as ./src/ or ~/, to see a dropdown of matching files and directories, then press Tab to accept. Use forward slashes on Windows too; the dropdown is triggered by /, not \
  • Exit with Escape, Backspace, or Ctrl+U on an empty prompt
  • Pasting text that starts with ! into an empty prompt enters shell mode automatically, matching typed ! behavior
As of v2.1.186, Claude responds to the command output automatically once it lands in the transcript, so you can run ! npm test and get an explanation of the failures without a second prompt. The response costs the same as sending a normal prompt. To restore the earlier behavior where the output is added to context without a response, set respondToBashCommands to false in settings.json. Before v2.1.186, shell mode always added output to context without a response. This is useful for quick shell operations while maintaining conversation context.

Prompt suggestions

When you first open a session, a grayed-out example command appears in the prompt input to help you get started. Claude Code picks this from your project’s git history, so it reflects files you’ve been working on recently. After Claude responds, suggestions continue to appear based on your conversation history, such as a follow-up step from a multi-part request or a natural continuation of your workflow.
  • Press Tab or Right arrow to place the suggestion in the prompt input, then Enter to submit
  • Start typing to dismiss it
The suggestion runs as a background request that reuses the parent conversation’s prompt cache, so the additional cost is minimal. Claude Code skips suggestion generation when the cache is cold to avoid unnecessary cost. Suggestions are automatically skipped after the first turn of a conversation and in plan mode. In print mode they are off by default. Pass --prompt-suggestions with -p "<prompt>" --output-format stream-json --verbose to emit a prompt_suggestion message after each turn instead. To disable prompt suggestions entirely, set the environment variable or toggle the setting in /config:

Side questions with /btw

Use /btw to ask a quick question about your current work without adding to the conversation history. This is useful when you want a fast answer but don’t want to clutter the main context or derail Claude from a long-running task.
Side questions have full visibility into the current conversation, so you can ask about code Claude has already read, decisions it made earlier, or anything else from the session. The question and answer are ephemeral: they appear in a dismissible overlay and never enter the conversation history.
  • Available while Claude is working: you can run /btw even while Claude is processing a response. The side question runs independently and doesn’t interrupt the main turn.
  • No tool access: side questions answer only from what is already in context. Claude can’t read files, run commands, or search when answering a side question.
  • Single response: there are no follow-up turns in the overlay. To continue the thread, fork it into its own session with f.
  • Low cost: the side question reuses the parent conversation’s prompt cache, so the additional cost is minimal.
Earlier side questions from the same session appear as a dimmed list above the current answer. They stay out of the conversation history but remain visible in the overlay until you clear them. To return to the overlay after dismissing it, run /btw with no question. The overlay reopens on your most recent exchange. Press Left to step back through earlier answers. Before v2.1.212, /btw without a question printed a usage message instead. Once the answer appears, the overlay accepts these keys. /btw is the inverse of a subagent: it sees your full conversation but has no tools, while a subagent has full tools but starts with an empty context. Use /btw to ask about what Claude already knows from this session; use a subagent to go find out something new.

Task list

The task list is Claude’s to-do checklist: items Claude created to plan multi-step work, with indicators showing what’s pending, in progress, or complete. It’s separate from the background-task view. To see running shells and subagents, use /tasks instead.
  • Press Ctrl+T to toggle the task list view. The display shows up to five tasks at a time. When Claude hasn’t created any checklist items yet, the toggle has no visible effect because there’s nothing to display
  • To see all tasks or clear them, ask Claude directly: “show me all tasks” or “clear all tasks”
  • Tasks persist across context compactions, helping Claude stay organized on larger projects
  • To share a task list across sessions, set CLAUDE_CODE_TASK_LIST_ID to use a named directory in ~/.claude/tasks/: CLAUDE_CODE_TASK_LIST_ID=my-project claude

Session recap

When you return to the terminal after stepping away, Claude Code shows a one-line recap of what happened in the session so far. The recap generates in the background once at least three minutes have passed since the last completed turn and the terminal is unfocused, so it’s ready when you switch back. Recaps only appear once the session has at least three turns, and never twice in a row. Run /recap to generate a summary on demand. To turn automatic recaps off, open /config and disable Session recap. Session recap is on by default for every plan and provider. The recap is always skipped in non-interactive mode.

PR review status

When working on a branch with an open pull request, Claude Code displays a clickable PR link in the footer, such as “PR #446”. The link has a colored underline indicating the review state:
  • Green: approved
  • Yellow: pending review
  • Red: changes requested
  • Gray: draft
The badge disappears once the pull request merges or closes. Cmd+click (macOS) or Ctrl+click (Windows/Linux) the link to open the pull request in your browser. The status refreshes every 60 seconds, and immediately after a gh pr or git push command runs in the session.
PR status requires the gh CLI to be installed and authenticated (gh auth login).

See also