Claude Code Controls and Modes

The core capabilities of Claude Code interactive mode includeKeyboard shortcuts、Vim editor mode、Command history managementandBackground Bash command execution, the following are the key extracted points:


1. Keyboard Shortcuts

Shortcut behavior varies by terminal and system. macOS users need to configure the Option key as Meta (see the original text for configuration paths in different terminals). Press?to view available shortcuts in the current environment.

Category Shortcut/Action Core function
General controls Ctrl+C Cancel current input/generation
Ctrl+D Exit session
Ctrl+L Clear screen (keep history)
Ctrl+O Toggle verbose output (show tool execution logs)
Ctrl+R Reverse search command history
Option+P/Alt+P Switch model (without clearing the prompt)
Text editing Ctrl+K/Ctrl+U Delete to end of line / delete entire line (deleted content can be pasted)
Ctrl+Y PasteCtrl+K/Ctrl+UDeleted content
Alt+B/Alt+F Move cursor forward/backward by word (requires Meta key configuration)
Theme display Ctrl+T Toggle code block syntax highlighting (only/themevalid within the menu)
Multi-line input \+Enter / Shift+Enter` Line break input (Shift+Enter requires no configuration in terminals such as iTerm2/WezTerm)
Ctrl+J Multi-line newline
Quick commands /Prefix Trigger slash commands (see the slash command documentation for details)
!Prefix Directly run Bash commands (output is counted in the session)
@ Trigger file path autocomplete

2. Vim Editor Mode

Use/vimto enable it temporarily, or/configconfigure it permanently, supporting Vim core operation logic.

1. Mode Switching

Command Operation Trigger scenario
Esc Enter NORMAL mode In INSERT mode
i/I Insert before cursor / at line start In NORMAL mode
a/A Insert after cursor / at line end In NORMAL mode
o/O Open a new line below/above In NORMAL mode

2. Core Operations (NORMAL mode)

  • Navigation:h/j/k/lMove up/down/left/right;w/e/bJump by word;gg/GJump to start/end of input
  • Editing:ddDelete line;yyCopy line;p/PPaste after/before cursor;>>/<<Indent/outdent
  • Text objects: combined withd/c/yusage, such asdi"deleting content inside double quotes,awselecting an entire word

3. Command History

  1. Storage rules: stored independently by working directory,/clearcommand can clear current session history
  2. Reverse search (Ctrl+R)
    • After pressing, enter keywords to match historical commands and highlight them
    • RepeatCtrl+RCycle through earlier matches
    • Tab/EscAccept match and edit,Enterexecute directly,Ctrl+Ccancel search

4. Background Bash Commands

Supports running time-consuming commands asynchronously without blocking session operations.

  1. How to run
    • Prompt Claude to run commands in the background
    • Press when executing a commandCtrl+B(Tmux users press twice), generating a unique task ID for tracking
  2. Bash mode (! prefix)
    • Input! commandCan directly execute Bash commands (without Claude intervention), example:! npm test
    • Commands and their output become part of the session context, supportsCtrl+Bbackground running, suitable for quickly executing shell operations
  3. Applicable scenarios: build tools, package management, test runs, development servers, and other long-running processes
Other extensions