Skip to content

Interactive Mode

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

Keyboard Shortcuts

General Controls

ShortcutDescriptionContextCodeBuddy Support
Ctrl+CCancel current input or generationStandard interrupt✅ Supported
Ctrl+DExit CodeBuddy Code session (when input box is empty and no conversation in progress)EOF signal, press twice to exit✅ 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 text or image from clipboard; on Windows, Alt+V is recommended for a more reliable experience when pasting large blocks of textPaste text, image, or image file path✅ Supported
Up/Down Arrow KeysNavigate command historyRecall previous inputs; when queued messages exist, Up will prioritize pulling queued messages back to the input box for editing✅ 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 (all platforms, Windows also supports Alt+M)Toggle permission modeCycle between default, bypassPermissions, acceptEdits, auto (when available), plan, delegate✅ Supported
Option+P (macOS) or Alt+P (Windows/Linux)Switch modelQuickly open model selection panel✅ Supported

In a blank session, use /agent-mode to switch the main Agent mode (Standard / PTC / Minimal / Create). When the input is empty and switching is still available, the prompt /agent-mode to switch appears below the input box, not on the permission prompt line. Your selection is saved to lastUsed and reused on the next launch. This is separate from the permission mode cycle controlled by Shift+Tab. Once the conversation starts, the mode is locked: the prompt disappears, and entering /agent-mode only explains that switching is unavailable. Use /clear to start a new session. WorkBuddy does not provide this entry point.

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 is used to toggle permission modes (all platforms, Windows also supports Alt+M as an alias). The current cycle order is: default → bypassPermissions → acceptEdits → auto (when available) → plan → delegate. dontAsk is not in the keyboard cycle; it must be entered via --permission-mode dontAsk or settings. Customizable via ~/.codebuddy/keybindings.json

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

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 the session; in this mode, press Shift+Tab to switch to the local shell submode (commands are not added to model context)✅ 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
Ctrl+YCopy last AI reply to clipboard✅ 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

Editing Queued Messages

When the Agent is responding, messages you type and submit will enter a queue, displayed above the input box. At this point, if the input box is empty, pressing the Up arrow key will pull queued messages back to the input box for continued editing (multiple queued messages are merged in send order, joined by newlines):

  • When the input box is empty and there are editable queued messages, a "Press ↑ to edit queued messages" prompt will be displayed
  • System-injected queue items (async task notifications, channel messages, teammate messages, etc.) will not be pulled back to the input box and will remain in the queue for automatic processing
  • If you are already using Up/Down to browse history, the arrow keys will continue to navigate history and will not interrupt

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 TaskOutput 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.

Local Shell Submode (Commands Excluded from Model Context)

Sometimes you want to run a few commands in the terminal while using CodeBuddy—such as git status, ls, or pwd—without polluting the model's conversation context. Bash mode provides a local shell submode for this purpose.

To enter it, first type ! to enter Bash mode, then press Shift+Tab to switch to local shell submode. The prompt changes to a different color (cyan/teal) for distinction. Press Shift+Tab again to return to regular Bash mode.

bash
! Enter Bash mode (the prompt is magenta, and commands are added to model context)
# In Bash mode, press Shift+Tab → the prompt turns teal and enters local shell submode
! git status   # Local shell submode: runs normally and displays results, but is not added to model context

Differences between local shell submode and regular Bash mode:

BehaviorRegular Bash mode (!)Local shell submode (! + Shift+Tab)
Display commands and output in the TUI
Add commands/output to model context (sent with the next request)
Write to the session record (replayed by --continue / --resume)
Prompt colorMagentaCyan/teal

Notes:

  • Commands and output are displayed transiently only in the current TUI session. The model cannot see them, and they are not replayed when continuing or resuming a session. They never enter session history (neither model context nor JSONL), so /btw, context compaction, and /fork cannot see local shell content either.
  • Transient output remains available in the current live session through window resizing, UI remounting, and the Ctrl+O detailed view, but only in a bounded in-process display and never on disk. Existing session-ending callbacks such as /clear, or rewinding a committed conversation, clear the local output. Regular context compaction does not proactively clear it. After leaving the current session, late output from old commands does not reappear.
  • Local shell does not accept image attachments. Submitting a draft containing images displays a notice and preserves the draft instead of falling back to a model conversation. In local mode, Tab does not add the command to the model message queue.
  • Local command recall exists only in memory for the current run: use Up/Down and Ctrl+R to recall local commands and their mode, but they are not written to the input history file and do not survive a CLI restart. History recall for regular Bash and chat input remains persistent under the existing rules.
  • Shift+Tab is used instead of typing ! again or pressing regular Tab: ! is a common shell character (!!, !$), regular Tab has other uses, and Shift+Tab is otherwise unused in Bash mode and is not an input character, so it does not conflict with command input.
  • With empty input, press Backspace to exit Bash / local shell mode and return to regular conversation input.

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
Auto-Accept Edits ModeAutomatically approves file editing operations (Edit/Write), other tools still require confirmationShift+Tab
Skip Permissions ModeBypasses all permission checks. Recommended for use only in sandboxes without internet accessShift+Tab
Plan ModeAI will formulate a plan and wait for approval before executionShift+Tab

Toggling Permission Modes

  • Use Shift+Tab to switch between modes (all platforms, Windows also supports Alt+M as an alias). Customizable via ~/.codebuddy/keybindings.json
  • 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.