Interactive Mode
Complete keyboard shortcuts, input modes, and interactive features reference for CodeBuddy Code interactive sessions.
Keyboard Shortcuts
General Controls
| Shortcut | Description | Context | CodeBuddy Support |
|---|---|---|---|
Ctrl+C | Cancel current input or generation | Standard interrupt | ✅ Supported |
Ctrl+D | Exit CodeBuddy Code session (when input box is empty and no conversation in progress) | EOF signal, press twice to exit | ✅ Supported |
Ctrl+L | Clear terminal screen | Preserves conversation history | ✅ Supported |
Ctrl+O | Toggle verbose output | Display detailed tool usage and execution information | ✅ Supported |
Ctrl+R | Reverse search command history | Interactive 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 text | Paste text, image, or image file path | ✅ Supported |
Up/Down Arrow Keys | Navigate command history | Recall previous inputs; when queued messages exist, Up will prioritize pulling queued messages back to the input box for editing | ✅ Supported |
Esc + Esc | Rewind code/conversation | Restore code and/or conversation to previous state (requires pressing ESC twice consecutively when the input box is empty) | ✅ Supported |
Tab | Toggle thinking mode | Switch between thinking on and thinking off | ✅ Supported |
Shift+Tab (all platforms, Windows also supports Alt+M) | Toggle permission mode | Cycle between default, bypassPermissions, acceptEdits, auto (when available), plan, delegate | ✅ Supported |
Option+P (macOS) or Alt+P (Windows/Linux) | Switch model | Quickly 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+Escrewind functionality is now supported: when the input box is empty, pressing the ESC key twice consecutively activates the/rewindfeature, allowing you to quickly revert code or conversation to a previous stateTabkey in CodeBuddy Code is primarily used for auto-completion, with partial support for thinking mode toggleShift+Tabis used to toggle permission modes (all platforms, Windows also supportsAlt+Mas an alias). The current cycle order is:default → bypassPermissions → acceptEdits → auto (when available) → plan → delegate.dontAskis not in the keyboard cycle; it must be entered via--permission-mode dontAskor settings. Customizable via~/.codebuddy/keybindings.json
Multi-line Input
| Method | Shortcut | Context | CodeBuddy Support |
|---|---|---|---|
| Quick escape | \ + Enter | Works in all terminals | ✅ Supported |
| macOS default | Option+Enter | Default setting on macOS | ✅ Supported |
| Terminal setup | Shift+Enter | After executing /terminal-setup | ✅ Supported |
| Control sequence | Ctrl+J | Line feed character for multi-line | ✅ Supported |
| Paste mode | Direct paste | For code blocks, logs | ✅ Supported |
Quick Commands
| Shortcut | Description | Notes | CodeBuddy Support |
|---|---|---|---|
# at start | Memory shortcut - Add to CODEBUDDY.md | Prompts for file selection | ✅ Supported |
/ at start | Slash commands | See Slash Commands | ✅ Supported |
! at start | Bash mode | Run 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 mention | Trigger file path auto-completion | ✅ Supported |
Editing Shortcuts
| Shortcut | Description | CodeBuddy Support |
|---|---|---|
Ctrl+A | Move to start of line | ✅ Supported |
Ctrl+E | Move to end of line | ✅ Supported |
Ctrl+K | Delete from cursor to end of line | ✅ Supported |
Ctrl+U | Delete from start of line to cursor | ✅ Supported |
Ctrl+W | Delete previous word | ✅ Supported |
Ctrl+Y | Copy last AI reply to clipboard | ✅ Supported |
Alt/Option+Backspace | Delete previous word | ✅ Supported |
Alt/Option+Delete | Delete next word | ✅ Supported |
Alt/Option+Left | Move to previous word | ✅ Supported |
Alt/Option+Right | Move to next word | ✅ Supported |
Ctrl+Left | Move to start of line | ✅ Supported |
Ctrl+Right | Move to end of line | ✅ Supported |
Ctrl+G | Open external editor to edit prompt | ✅ Supported |
Vim Editor Mode
Enable vim-style editing with the /vim command, or configure permanently via /config.
Mode Switching
| Command | Action | From Mode | CodeBuddy Support |
|---|---|---|---|
Esc | Enter NORMAL mode | INSERT | ✅ Supported |
i | Insert before cursor | NORMAL | ✅ Supported |
I | Insert at start of line | NORMAL | ✅ Supported |
a | Insert after cursor | NORMAL | ✅ Supported |
A | Insert at end of line | NORMAL | ✅ Supported |
o | Open new line below | NORMAL | ✅ Supported |
O | Open new line above | NORMAL | ✅ Supported |
Navigation (NORMAL Mode)
| Command | Action | CodeBuddy Support |
|---|---|---|
h/j/k/l | Move left/down/up/right | ✅ Supported |
w | Next word | ✅ Supported |
e | End of word | ✅ Supported |
b | Previous word | ✅ Supported |
0 | Start of line | ✅ Supported |
$ | End of line | ✅ Supported |
^ | First non-whitespace character | ✅ Supported |
gg | Start of input | ✅ Supported |
G | End of input | ✅ Supported |
Editing (NORMAL Mode)
| Command | Action | CodeBuddy Support |
|---|---|---|
x | Delete character | ✅ Supported |
dd | Delete line | ✅ Supported |
D | Delete to end of line | ✅ Supported |
dw/de/db | Delete word/to end/to start | ✅ Supported |
cc | Change line | ✅ Supported |
C | Change to end of line | ✅ Supported |
cw/ce/cb | Change 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
/clearto 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/Downto 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:
- Start search: Press
Ctrl+Rto activate reverse history search - Enter query: Type text to search in previous commands - search terms will be highlighted in matching results
- Navigate matches: Press
Ctrl+Ragain to cycle through earlier matches - Accept match:
- Press
TaborEscto accept the current match and continue editing - Press
Enterto accept and execute the command immediately
- Press
- Cancel search:
- Press
Ctrl+Cto cancel and restore original input - Press
Backspaceon empty search to cancel
- Press
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+Bto move a regular Bash tool call to the background. (Tmux users must pressCtrl+Btwice 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 -laBash mode:
- Adds commands and their output to the conversation context
- Displays live progress and output
- Supports the same
Ctrl+Bfor 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 contextDifferences between local shell submode and regular Bash mode:
| Behavior | Regular 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 color | Magenta | Cyan/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/forkcannot see local shell content either. - Transient output remains available in the current live session through window resizing, UI remounting, and the
Ctrl+Odetailed 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,
Tabdoes not add the command to the model message queue. - Local command recall exists only in memory for the current run: use
Up/DownandCtrl+Rto 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+Tabis used instead of typing!again or pressing regularTab:!is a common shell character (!!,!$), regularTabhas other uses, andShift+Tabis 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
| Mode | Description | Toggle Shortcut |
|---|---|---|
| Normal Mode (Default) | Asks for confirmation of tool usage based on permission rules | Shift+Tab |
| Auto-Accept Edits Mode | Automatically approves file editing operations (Edit/Write), other tools still require confirmation | Shift+Tab |
| Skip Permissions Mode | Bypasses all permission checks. Recommended for use only in sandboxes without internet access | Shift+Tab |
| Plan Mode | AI will formulate a plan and wait for approval before execution | Shift+Tab |
Toggling Permission Modes
- Use
Shift+Tabto switch between modes (all platforms, Windows also supportsAlt+Mas an alias). Customizable via~/.codebuddy/keybindings.json - Specify startup mode using the
--permission-modecommand line argument:bashcodebuddy --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.
Related Documentation
- Slash Commands - Interactive session commands
- CLI Reference - Command line flags and options
- Settings Configuration - Configuration options
- Memory Management - Managing CODEBUDDY.md files
- IAM Permissions - Tool permissions and access control
- Bash Sandboxing - Bash command sandboxing mode
Tip: Type
?at any time in an interactive session to see available shortcuts and commands. Use the/helpcommand for more help information.