Skip to content

Interactive Mode

Complete keyboard shortcuts, input modes, and interactive features reference for CodeBuddy Code interactive sessions.

Keyboard Shortcuts

NOTE

Keyboard shortcuts may vary by platform and terminal. Type a question mark `?` in an interactive session to see the shortcuts available in your environment.

General Controls

ShortcutDescriptionContextCodeBuddy Support
Ctrl+CCancel current input or generationStandard interrupt✅ Supported
Ctrl+DExit CodeBuddy Code sessionEOF signal✅ Supported
Ctrl+LClear terminal screenPreserves conversation history✅ Supported
Ctrl+OToggle verbose outputDisplay detailed tool usage and execution information✅ Supported
Ctrl+RReverse search command historyInteractive search of previous commands✅ Supported
Ctrl+V (macOS/Linux) or Alt+V (Windows)Paste image from clipboardPaste image or image file path✅ Supported
Up/Down Arrow KeysNavigate command historyRecall previous inputs✅ Supported
Esc + EscRewind code/conversationRestore code and/or conversation to previous state (requires pressing ESC twice consecutively when the input box is empty)✅ Supported
TabToggle thinking modeSwitch between thinking on and thinking off✅ Supported
Shift+Tab or Alt+M (some configs)Toggle permission modeSwitch between auto-accept, plan, and normal modes✅ Supported

Notes:

  • Esc + Esc rewind functionality is now supported: when the input box is empty, pressing the ESC key twice consecutively activates the /rewind feature, allowing you to quickly revert code or conversation to a previous state
  • Tab key in CodeBuddy Code is primarily used for auto-completion, with partial support for thinking mode toggle
  • Shift+Tab and Alt+M (Windows) are used to toggle permission modes, including normal mode, auto-accept edits mode, skip permissions mode, and plan mode

Multi-line Input

MethodShortcutContextCodeBuddy Support
Quick escape\ + EnterWorks in all terminals✅ Supported
macOS defaultOption+EnterDefault setting on macOS✅ Supported
Terminal setupShift+EnterAfter executing /terminal-setup✅ Supported
Control sequenceCtrl+JLine feed character for multi-line✅ Supported
Paste modeDirect pasteFor code blocks, logs✅ Supported

TIP

Configure your preferred line break behavior in terminal settings. Run `/terminal-setup` to install Shift+Enter bindings for iTerm2 and VS Code terminal.

Quick Commands

ShortcutDescriptionNotesCodeBuddy Support
# at startMemory shortcut - Add to CODEBUDDY.mdPrompts for file selection✅ Supported
/ at startSlash commandsSee Slash Commands✅ Supported
! at startBash modeRun commands directly and add execution output to session✅ Supported
@File path mentionTrigger file path auto-completion✅ Supported

Editing Shortcuts

ShortcutDescriptionCodeBuddy Support
Ctrl+AMove to start of line✅ Supported
Ctrl+EMove to end of line✅ Supported
Ctrl+KDelete from cursor to end of line✅ Supported
Ctrl+UDelete from start of line to cursor✅ Supported
Ctrl+WDelete previous word✅ Supported
Alt/Option+BackspaceDelete previous word✅ Supported
Alt/Option+DeleteDelete next word✅ Supported
Alt/Option+LeftMove to previous word✅ Supported
Alt/Option+RightMove to next word✅ Supported
Ctrl+LeftMove to start of line✅ Supported
Ctrl+RightMove to end of line✅ Supported
Ctrl+GOpen external editor to edit prompt✅ Supported

Vim Editor Mode

Enable vim-style editing with the /vim command, or configure permanently via /config.

Mode Switching

CommandActionFrom ModeCodeBuddy Support
EscEnter NORMAL modeINSERT✅ Supported
iInsert before cursorNORMAL✅ Supported
IInsert at start of lineNORMAL✅ Supported
aInsert after cursorNORMAL✅ Supported
AInsert at end of lineNORMAL✅ Supported
oOpen new line belowNORMAL✅ Supported
OOpen new line aboveNORMAL✅ Supported
CommandActionCodeBuddy Support
h/j/k/lMove left/down/up/right✅ Supported
wNext word✅ Supported
eEnd of word✅ Supported
bPrevious word✅ Supported
0Start of line✅ Supported
$End of line✅ Supported
^First non-whitespace character✅ Supported
ggStart of input✅ Supported
GEnd of input✅ Supported

Editing (NORMAL Mode)

CommandActionCodeBuddy Support
xDelete character✅ Supported
ddDelete line✅ Supported
DDelete to end of line✅ Supported
dw/de/dbDelete word/to end/to start✅ Supported
ccChange line✅ Supported
CChange to end of line✅ Supported
cw/ce/cbChange word/to end/to start✅ Supported
.Repeat last change✅ Supported

Command History

CodeBuddy Code maintains command history for the current session:

  • History is stored by working directory
  • Use /clear to start a fresh conversation (old conversations can be resumed via /resume)
  • Navigate using Up/Down arrow keys (see keyboard shortcuts above)
  • Note: History expansion (!) is disabled by default

Reverse Search with Ctrl+R

Press Ctrl+R to interactively search your command history:

  1. Start search: Press Ctrl+R to activate reverse history search
  2. Enter query: Type text to search in previous commands - search terms will be highlighted in matching results
  3. Navigate matches: Press Ctrl+R again to cycle through earlier matches
  4. Accept match:
    • Press Tab or Esc to accept the current match and continue editing
    • Press Enter to accept and execute the command immediately
  5. Cancel search:
    • Press Ctrl+C to cancel and restore original input
    • Press Backspace on empty search to cancel

The search displays matching commands and highlights search terms, making it easy to find and reuse previous inputs.

Background Bash Commands

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

How Background Execution Works

When CodeBuddy Code runs a command in the background, it runs the command asynchronously and immediately returns a background task ID. CodeBuddy Code can respond to new prompts while the command continues to execute in the background.

To run a command in the background, you can:

  • Prompt CodeBuddy Code to run the command in the background
  • Press Ctrl+B to move a regular Bash tool call to the background. (Tmux users must press Ctrl+B twice due to tmux's prefix key.)

Key features:

  • Output is buffered and CodeBuddy can retrieve it using the BashOutput tool
  • Background tasks have unique IDs for tracking and output retrieval
  • Background tasks are automatically cleaned up when CodeBuddy Code exits

Common background commands:

  • Build tools (webpack, vite, make)
  • Package managers (npm, yarn, pnpm)
  • Test runners (jest, pytest)
  • Development servers
  • Long-running processes (docker, terraform)

Bash Mode with ! Prefix

Run bash commands directly by prefixing your input with !, without going through CodeBuddy:

bash
! npm test
! git status
! ls -la

Bash mode:

  • Adds commands and their output to the conversation context
  • Displays live progress and output
  • Supports the same Ctrl+B for running long-running commands in the background
  • Doesn't require CodeBuddy to interpret or approve commands

This is useful for quick shell operations while maintaining conversation context.

Permission Modes

CodeBuddy Code supports multiple permission modes to control how tool usage is authorized:

Available Modes

ModeDescriptionToggle Shortcut
Normal Mode (Default)Asks for confirmation of tool usage based on permission rulesShift+Tab/Alt+M
Auto-Accept Edits ModeAutomatically approves file editing operations (Edit/Write), other tools still require confirmationShift+Tab/Alt+M
Skip Permissions ModeBypasses all permission checks. Recommended for use only in sandboxes without internet accessShift+Tab/Alt+M
Plan ModeAI will formulate a plan and wait for approval before executionShift+Tab/Alt+M

Toggling Permission Modes

  • Use Shift+Tab (most terminals) or Alt+M (Windows) to cycle through modes
  • Specify startup mode using the --permission-mode command line argument:
    bash
    codebuddy --permission-mode acceptEdits
    codebuddy --permission-mode bypassPermissions
    codebuddy --permission-mode plan
  • Set default mode in settings.json:
    json
    {
      "permissions": {
        "defaultMode": "acceptEdits"
      }
    }

Permission Rules

Permission modes work in conjunction with permission rules to provide fine-grained control. See the IAM documentation for details on configuring permission rules.


Tip: Type ? at any time in an interactive session to see available shortcuts and commands. Use the /help command for more help information.