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+D, Alt+Y, Alt+P) require configuring Option as Meta in your terminal. See Enable Option key shortcuts on macOS for the setting in each terminal.

General controls

Text editing

Make editing keys follow readline conventions

Set keybindingFlavor to "readline" to make the prompt’s editing keys follow GNU readline conventions, as in Bash. The default value is "classic". Requires Claude Code v2.1.238 or later. Under "readline":
  • Ctrl+W deletes back to the previous whitespace.
  • A word is a run of letters and digits, so punctuation such as _, ., and / separates words. Alt+F and Alt+D stop at the end of the current word, and Ctrl+Y can paste back text that Alt+D deleted. Before v2.1.239, Claude Code applied "readline" only to Ctrl+W.
Add the setting to ~/.claude/settings.json:
To confirm, type fix the bug in src/utils/foo.ts in the prompt and press Ctrl+W. Claude Code removes src/utils/foo.ts. Under "classic" it removes only foo.ts. This setting is separate from the keybindings configuration file: the word-editing commands aren’t actions there, so you can’t remap them in keybindings.json.

Theme and display

Multiline input

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. Ctrl+E can be rebound via transcript:toggleShowAll.

Voice input

Commands

Type / in Claude Code to see the commands available to you, or type / followed by any letters to filter. The / menu lists 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, and a few available commands are hidden from the menu by design and run when you type their full name. 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. Claude Code keeps your vim mode and cursor position when you toggle the transcript viewer with Ctrl+O or open and close a panel such as /config. If you leave the prompt in NORMAL mode, it’s still in NORMAL mode when you return, with the cursor where you left it.

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 / navigate command history instead. on an empty prompt opens agent view from NORMAL mode as well as INSERT; before v2.1.219, on an empty prompt did nothing in NORMAL mode.

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 keeps a history of the prompts you type, and Up-arrow recall reaches prompts from past sessions of the same project:
  • Input history is stored per working directory
  • Running /clear starts a new session: recall then lists the new session’s prompts first, with earlier sessions’ prompts after them. 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
  • When you recall a prompt that included pasted text, Claude Code sends the full pasted content again when you resubmit. If the content has since been cleaned up, Claude Code doesn’t send the literal [Pasted text #N] string; see Paste large content for what happens to the prompt
  • 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 classic renderer’s 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 searches your whole prompt history in the selected scope, newest first, with duplicates collapsed to the newest occurrence: the most recent prompts appear immediately, and matches from older prompts fill in as Claude Code loads the rest. 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.

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. If you background the session instead of exiting it, Claude Code 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
  • On macOS and Linux, Claude Code terminates running background tasks when the operating system signals memory pressure, provided the session has been idle for at least 30 minutes and no turn or subagent is running. Set CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP to 1 to turn this off. Requires Claude Code v2.1.193 or later. Background commands owned by a subagent are instead terminated after 60 minutes, configurable in milliseconds with CLAUDE_SUBAGENT_BG_SHELL_MAX_MS. A command owned by a subagent running in the foreground also ends when that subagent gives its final response; see Background commands in the tools reference. Before v2.1.218, neither the memory-pressure reap nor the 60-minute limit covered commands moved to the background with Ctrl+B
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
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.

Queue messages while Claude works

Type a message and press Enter while Claude is working. Claude Code queues the message instead of interrupting the turn, and lists the queued entries above the input box until it sends them. You can queue ! shell commands and most commands the same way, apart from the commands, such as /status, that Claude Code runs as soon as you send them.

When Claude Code sends what you queued

When a queued entry reaches Claude depends on what you queued.
  • Messages: if you queue a message while Claude is running tool calls, Claude Code passes it to Claude as soon as those tool calls finish, within the same turn. When the turn ends, Claude Code sends the messages that are still queued as the next turn, each as a separate message
  • Commands and shell commands: Claude Code holds them until the turn ends, then runs them one at a time
Press Esc to interrupt the turn instead. Claude Code keeps what you queued and sends it right away.

Take back what you queued

Press Up from the first line of the input box to take back the queued messages and commands. Claude Code removes them from the queue and puts them in the input box, one per line, ahead of any text you had typed. Edit the text and press Enter to queue it again as one entry, or clear the input box to drop it. Claude Code takes back queued shell commands only when the input box is empty and you have nothing else queued, and it switches the input box to shell mode when it does. Otherwise it leaves them in the queue, listed with their ! prefix, and runs them after the turn ends.

Prompt suggestions

When you first open a session, Claude Code shows a grayed-out example command in the prompt input to help you get started. It picks this from your project’s git history, so the example reflects files you’ve been working on recently. After Claude responds, Claude Code can suggest your next prompt 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
Claude Code generates each of these next-prompt suggestions with a background request that reuses the conversation’s prompt cache, so the additional cost is minimal.

When Claude Code skips suggestions

In interactive mode, Claude Code leaves prompt suggestions off by default and hides the Prompt suggestions toggle in /config when it doesn’t evaluate feature flags. That happens in these cases: Outside those cases, if you start a session before Claude Code has ever fetched feature flags, such as your first session after installing on a slow network, Claude Code can also leave suggestions off and hide the Prompt suggestions toggle for that session. It shows them starting with the next session after a fetch succeeds. Claude Code also skips individual suggestions in several situations, including:
  • The prompt cache is cold, to avoid unnecessary cost
  • After the first turn of a conversation, in some sessions
  • The previous response ended in an error
  • While you’re in plan mode
  • Your account is close to or at its usage limit. To keep suggestions on until you reach the limit, set CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION to true. Before v2.1.238, Claude Code skipped them near the limit even with the variable set to true
  • In an agent team, in teammates’ sessions by default. The lead’s session shows suggestions
In print mode, Claude Code doesn’t generate suggestions by default. Pass --prompt-suggestions with -p "<prompt>" --output-format stream-json --verbose to have Claude Code emit a prompt_suggestion message after each turn that generates one. The generator skips very short conversations and cold prompt caches here too, so a single short -p query can emit none.

Turn prompt suggestions off

To disable prompt suggestions entirely, use any of the following: To turn prompt suggestions off across an organization, set promptSuggestionEnabled to false in managed settings. Also set CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION to false under the managed env key so that users can’t re-enable them with their own environment variable.

Emoji shortcodes

Type a : followed by an emoji shortcode in the prompt input to insert the emoji. Requires Claude Code v2.1.217 or later.
  • Type a complete shortcode such as :heart: and Claude Code replaces it with ❤️ as soon as you type the closing :
  • Type : plus at least two characters of a name, such as :hea, to open a suggestion popup, then press Tab or Enter to insert the highlighted emoji
The shortcode must start the input or follow a space, so a : inside a word or URL doesn’t open suggestions. To turn the feature off, set emojiCompletionEnabled to false in settings.json. This disables both the suggestion popup and the inline replacement.

Check spelling as you type

Claude Code can underline misspelled words in the prompt input while you type. It checks only the text in the input box, never Claude’s replies or your files. It also checks nothing while the input box is in shell mode, Ctrl+R history search, or voice dictation. Spell checking is off by default, and Claude Code checks nothing in screen reader mode. Requires Claude Code v2.1.235 or later.

Prerequisites

  • Install aspell, hunspell, or ispell and make sure it’s on your PATH. Claude Code runs the first of the three it finds, in that order, on every platform, including a .cmd shim a package manager installs on Windows.
  • To check that the program is on your PATH, run aspell --version, hunspell --version, or ispell -v in your terminal. A “command not found” error means it isn’t on your PATH yet.

Turn spell checking on or off

Claude Code reads the spellcheck setting from three places, and ignores it in a project’s .claude/settings.json and .claude/settings.local.json. Turn it on from whichever one you use:
Add spellcheck to ~/.claude/settings.json. It applies in every project you open, like the rest of your user settings:
To check that spell checking is on, type a misspelled word and a space. Claude Code underlines the word. If it doesn’t, see When Claude Code underlines nothing. To turn spell checking off again, set enabled to false in the same place, or remove spellcheck. To choose which of the three programs Claude Code runs, which dictionary it uses, or the underline color, add any of these fields next to enabled, in the same place:
  • checker: aspell, hunspell, or ispell. Claude Code doesn’t fall back from a checker you name, and treats any other value as auto.
  • language: a dictionary name in your checker’s form, such as en_GB. Claude Code ignores any value that isn’t a plain dictionary name, such as a path or a name with spaces, and the checker uses its default dictionary.
  • color: a color name such as yellow, or a #rrggbb, #rgb, rgb(r,g,b), ansi256(n), or ansi:<name> value. Claude Code uses your theme’s error color by default and for any value it doesn’t recognize.
For example, this spellcheck setting runs hunspell with its en_GB dictionary and underlines words in yellow. It works the same in ~/.claude/settings.json, in the file you pass to --settings, and in managed settings:
If more than one of the three places has a spellcheck setting, Claude Code uses only one of them: managed settings first, then --settings, then user settings. It doesn’t combine fields from two places. For example, when --settings sets spellcheck, a language in your user settings has no effect.

What Claude Code underlines

Shortly after you pause typing, Claude Code underlines the words the dictionary doesn’t know. It leaves the word you’re still typing alone until you move past it, and it never changes your text. It also skips text that looks like code:
  • Commands such as /help, @ mentions, URLs, file paths, and flags such as --verbose
  • Words with digits, underscores, or a capital letter after the first, and text in backticks
Claude Code also skips Chinese, Japanese, Korean, Thai, Lao, Khmer, and Myanmar text. Claude Code has no word list of its own: a word is misspelled when your checker says so. To stop Claude Code from underlining a word, add the word to your checker’s personal dictionary, following the checker’s own documentation. Claude Code picks up the new word after you restart it.

When Claude Code underlines nothing

Claude Code underlines nothing when it can’t keep a checker running:
  • No checker is installed, or the one you named in checker is missing
  • The checker fails twice in a row, at startup or later in the session. Claude Code restarts it after the first failure and stops checking after the second, until you restart Claude Code
  • The checker takes more than 15 seconds to answer, three times. Each time, Claude Code leaves the words it was waiting on unmarked; after the third, it stops checking until you restart Claude Code
To find out which of these happened, start claude --debug with spell checking on and type a word. Then look for the [spellcheck] lines in the debug log at ~/.claude/debug/<session-id>.txt. One line names the program Claude Code started, or lists the ones it looked for and didn’t find. Later lines say why it stopped. A missing-dictionary error there means the checker has no dictionary for your language value, or no default one when language is unset. Install one, or set language to a dictionary you have.

Side questions with /btw

Use /btw to ask a question about your current work without adding to the conversation history.
Claude answers a side question from what’s already in the conversation: your messages, its replies, and the tool results it has gathered. You can ask about code Claude has already read, decisions it made earlier, or anything else from the session. A later side question also sees your earlier side questions: Claude Code replays the newest 20 exchanges with each ask, until you clear them. The question and answer never enter the conversation history. In the terminal, they appear in a dismissible overlay. The terminal keeps the thread in memory: press x to clear the earlier exchanges, and it’s gone when you exit Claude Code. In the VS Code extension’s chat panel, /btw opens a panel rather than the overlay this section describes, and you ask follow-up questions right in the panel. The panel’s thread survives window reloads, on the retention schedule that page describes. You need the extension at v2.1.227 or later. Earlier extension versions don’t offer /btw.
  • 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. It sees everything in the conversation so far, except the reply Claude is still writing.
  • 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, ask another /btw question. To continue with full tool access in a local session, press f to fork this question and answer into a background subagent.
  • Low cost: while the conversation’s prompt cache is warm, a side question costs little beyond the answer itself.
Your five newest earlier side questions appear as a dimmed list above the current answer, with a count of any older ones. They stay out of the conversation history. 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. 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. On Opus 4.8, Sonnet 5, Fable 5, Mythos 5, and later versions of those families, Claude keeps track of multi-step work without a written checklist, and Claude Code doesn’t provide the tools that fill this list, so it stays empty. If you’d like the task list on those models anyway, opt in with CLAUDE_CODE_ENABLE_TODO_TOOLS=1 or one of the other ways under Task tool availability. On earlier models such as Opus 4.7, and after you opt in, the task list works as follows:
  • 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
  • If you leave the list expanded, Claude Code restores the expanded view the next time you launch into a session that still has tasks, such as with --resume or --continue. When the task list is empty, Claude Code starts it collapsed
  • 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. Claude Code caps both automatic recaps and /recap output at 400 characters. To turn automatic recaps off, open /config and turn off 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. How often Claude Code refreshes the status depends on your provider:
  • Anthropic API with feature-flag fetching on: about every 90 seconds while you’re active in the session, and less often while you’re idle, while your terminal is unfocused, or while Claude Code keeps finding no pull request for the branch
  • Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, Claude Platform on AWS, or feature-flag fetching off: every 60 seconds
On either schedule, Claude Code also refreshes as soon as a git push, or a gh pr command that changes the pull request such as gh pr create or gh pr merge, succeeds in the session. After an hour without input from you, Claude Code stops refreshing, and your next prompt starts it again. Claude Code renders the badge as a hyperlink even when it can’t detect hyperlink support in your terminal, which commonly happens over SSH or in tmux. Set FORCE_HYPERLINK=0 to render the badge as plain text.
PR status for GitHub repositories requires the gh CLI to be installed and authenticated with gh auth login.

GitLab merge requests

When you work on a branch with an open GitLab merge request, Claude Code shows a clickable MR !N badge in the footer slot that otherwise holds the GitHub PR link. !N is GitLab’s own reference syntax for merge request number N. The colored underline shows the merge request’s state:
  • Green: GitLab reports the merge request as mergeable
  • Yellow: any other open state
  • Gray: draft
The badge disappears once the merge request merges or closes. Claude Code checks merge request status on the same schedule as the GitHub badge, and refreshes as soon as a glab mr create or git push succeeds in the session. To get the badge, you need:
  • Claude Code v2.1.234 or later
  • A repository remote that points at your GitLab host, either gitlab.com or a self-managed instance
  • The glab CLI on your PATH, authenticated with glab auth login
Claude Code ignores glab’s token environment variables, such as GITLAB_TOKEN, when it checks status, so you get no badge from an exported token alone. Claude Code also looks for glab and for its login once per session, so restart Claude Code after you install glab or run glab auth login.

See also