little cups of claude

tips and techniques for Claude and Claude Code

#20: Keyboard Shortcuts Worth Knowing 🎹

Today we'll look at a handful of keyboard shortcuts that make day-to-day work in Claude Code a lot smoother.

Most of us learn Esc and Ctrl+C on day one and stop there. There's a lot more tucked away, and a few of these end up getting used dozens of times a day. Let's take a look.

Steering Mid-Turn

Esc stops Claude mid-response or mid-tool-call so we can redirect. It keeps the work done so far.

We don't always need to interrupt, though. Typing a message and pressing Enter while Claude is working queues it instead:

actually, use the existing retry helper in lib/http.ts

If Claude is in the middle of tool calls, it picks up our message as soon as those finish, in the same turn. Ctrl+Enter sends queued messages right away, and Up from the first line takes them back for editing.

Double Esc

Pressing Esc twice does two different things depending on the prompt:

  • With text in it, it clears the draft and saves it to history, so Up brings it back.
  • With an empty prompt, it opens the rewind menu to restore code or the conversation from an earlier point.

The Bang Prefix

Starting a prompt with ! runs a shell command directly, without Claude interpreting or approving it:

! bun test
! git status

The command and its output land in the conversation, and Claude responds to the output automatically. So ! bun test followed by nothing else gets us an explanation of the failures. Neat!

Handy Ones To Remember

A few more worth committing to muscle memory:

Shift+Tab     cycle permission modes (incl. plan)
Ctrl+O        transcript viewer, full tool details
Ctrl+R        reverse search prompt history
Ctrl+S        stash the prompt, press again to restore
Ctrl+G        edit the prompt in our $EDITOR
Ctrl+B        send a running command to the background
Option+P      switch models without losing our prompt

Ctrl+S is great when we're halfway through typing a long prompt and need to ask something else first. On Linux and Windows, Option+P is Alt+P.

Multiline Prompts

For multiline input, \ followed by Enter works in every terminal. Ctrl+J does too. Shift+Enter works natively in iTerm2, Ghostty, Kitty, WezTerm, Warp, Apple Terminal, and Windows Terminal.

Typing ? on an empty prompt toggles a help panel listing what's available.

Making Them Our Own

Running /keybindings creates or opens ~/.claude/keybindings.json. Bindings are grouped by context:

{
  "$schema": "https://www.schemastore.org/claude-code-keybindings.json",
  "bindings": [
    {
      "context": "Chat",
      "bindings": {
        "ctrl+e": "chat:externalEditor",
        "ctrl+s": null
      }
    }
  ]
}

That binds Ctrl+E to open the external editor and unbinds Ctrl+S. Changes are picked up without a restart.

Watch Out

Ctrl+C with nothing running clears the prompt on the first press and exits on the second. If we clear a draft by accident, it's still in history.

On macOS, shortcuts like Alt+B and Alt+F for word movement need Option set up as Meta in our terminal, and so does Option+P. The Option+T one works without it.

More info about keyboard shortcuts can be found at the Claude Code docs.

Share

Share on Threads

Similar Cups