Skip to main content

Keyboard Shortcuts

AI-assisted

Complete Claude Code shortcuts guide: Shift+Tab mode switching, Esc+Esc rewind, Ctrl+S prompt stash, Ctrl+B background tasks, Readline keys & more

Claude Code's shortcut system is richer than most people realize -- press ? to see every shortcut available in your current context.

Shift+Tab: Cycle Through Modes

This is probably the single most important shortcut. Pressing Shift+Tab cycles between three modes:

Normal Mode → Auto-Accept Mode → Plan Mode → Normal Mode

No need to type /plan or /auto-accept manually -- one key does it all. My workflow: when I get a new task, I tap it twice to jump into Plan Mode, confirm the approach, then tap once more to switch to Auto-Accept and let Claude execute on its own.

Esc + Esc: The Time Machine

Claude Code Esc+Esc rewind menu
Double-tap Esc to bring up the rewind menu

Double-tap Esc and a rewind menu pops up:

Claude Code rewind restore options
Three restore modes: restore code and conversation, conversation only, or code only
  • Restore code and conversation: Roll back to a previous checkpoint -- both files and chat history revert
  • Conversation only: Roll back messages but keep the current code changes
  • Code only: Undo file modifications but keep the conversation history

Claude automatically tracks every file edit as a checkpoint. This is far more granular than git checkout . because you can step back to any individual edit, not just the last commit.

One caveat: only files that Claude edited directly through tools are tracked. Files you changed by hand, git push, or other external operations can't be rewound.

Ctrl+S: Prompt Stash

Halfway through writing a prompt and need to handle something else first? Press Ctrl+S and your current input gets stashed:

Claude Code Ctrl+S prompt stash
After pressing Ctrl+S the prompt is stashed and automatically restores after your next message

You can then type another command or question. After you submit that message, the stashed content automatically restores into the input box so you can pick up right where you left off.

Think of it as git stash but for prompts. Example scenario: you're writing a lengthy refactoring request, then realize you want Claude to check a file first -- press Ctrl+S to stash the request, ask your file question, and once that's answered your request comes right back.

Ctrl+B: Send Tasks to the Background

Claude is in the middle of a long-running task (like a big refactor) and you want to work on something else? Press Ctrl+B to push the current task to the background -- your terminal is immediately free for new input.

Use Ctrl+T to view the background task list, and double-tap Ctrl+F to kill all background agents.

tmux users: tmux's default prefix key is also Ctrl+B, so you'll need to press it twice to trigger Claude's background feature.

Ctrl+G: Write Long Prompts in Your Editor

Sometimes you need to give Claude a lengthy set of instructions and typing in the terminal is painful. Press Ctrl+G to open your system's default $EDITOR (VS Code, Vim, etc.), write your prompt there, and it gets sent to Claude automatically when you save and close.

To change the default editor, set it in your shell config (~/.zshrc or ~/.bashrc):

# VS Code
export EDITOR="code --wait"

# Zed
export EDITOR="zed --wait"

# Vim
export EDITOR="vim"

The --wait flag is important -- it tells the editor to block until you close the file, otherwise Claude receives empty content immediately. Terminal editors like Vim block naturally, so they don't need it.

Super useful for multi-paragraph requirement descriptions or pasting large reference material. In Plan Mode, you can even use Ctrl+G to edit Claude's generated plan directly in your editor.

Cmd+T: Toggle Extended Thinking

The default shortcut is Cmd+T (or Meta+T on Windows/Linux) and it toggles Extended Thinking mode. When enabled, Claude reasons more deeply before responding -- great for complex architecture decisions or tricky bug hunts.

Fair warning: most terminals (iTerm2, Terminal.app, Warp, etc.) intercept Cmd+T as "new tab," so this shortcut often doesn't work in practice. Two workarounds: use /keybindings to remap it to a non-conflicting key, or just use the /effort command to switch thinking depth (same effect, plus you get fine-grained level control).

Readline Shortcuts

Claude Code's input box supports standard Readline shortcuts -- terminal veterans will feel right at home:

ShortcutAction
Ctrl+AJump to beginning of line
Ctrl+EJump to end of line
Ctrl+WDelete previous word
Ctrl+UDelete to beginning of line
Ctrl+KDelete to end of line
Ctrl+YPaste last deleted text
Alt+YCycle through delete history
Option+Left/RightJump by word (Mac)

Approval Shortcuts: y/n/d/e

When Claude proposes a file change and waits for confirmation, four single-key shortcuts control the flow:

  • y: Accept
  • n: Reject
  • d: View full diff
  • e: Edit before accepting

e is the most overlooked yet most useful one -- it lets you tweak Claude's changes before they're applied. Not happy with a few lines? No need to reject and redo; just press e and fix it.

Quick Reference

ShortcutAction
Shift+TabCycle modes: Normal → Auto-Accept → Plan
Esc+EscOpen rewind menu
Ctrl+SStash current input, auto-restores after next submit
Ctrl+BPush current task to background
Ctrl+TView background task list
Ctrl+F (x2)Kill all background agents
Ctrl+GWrite prompt in external editor
Ctrl+OToggle verbose tool output view
Cmd+TToggle extended thinking (may be intercepted by terminal; consider remapping or using /effort)
\ + EnterMulti-line input (no setup needed)
Shift+EnterMulti-line input (requires /terminal-setup first)
Up / DownBrowse input history
Ctrl+RSearch command history
Ctrl+LClear screen (history preserved)
Ctrl+CCancel current generation
Ctrl+DExit Claude Code
?Show all available shortcuts

Custom Keybindings

If the defaults don't suit you, run /keybindings to open ~/.claude/keybindings.json and customize away. Changes take effect immediately -- no restart required.

The syntax supports combo keys (e.g., ctrl+shift+c) and chord sequences (e.g., ctrl+k ctrl+s -- press Ctrl+K, release, then press Ctrl+S). There are 16 different binding contexts (Chat, Autocomplete, Confirmation, DiffDialog, etc.), each with its own set of bindable actions.

Comments

Table of Contents

Keyboard Shortcuts | Yu's Cyber Desk