Pi Agent: Keybindings & Theme Customization

Last updated: 2026-08-31

Tools feel right when they fit your hands. Keybindings and themes are your "workstation calibration."


1. Keyboard Shortcuts

(1) Default Shortcuts

Shortcut Function
Ctrl+C Interrupt current operation / Exit
Ctrl+D Exit interactive mode
Enter Send message
Ctrl+L Clear screen
Tab Auto-complete (commands/filenames)
Up/Down Browse message history
Ctrl+R Regenerate last response
Ctrl+E Edit last message
Ctrl+K Delete to end of line

(2) Custom Shortcuts

Configure in ~/.pi-agent/keybindings.yaml:

YAML
keybindings:
  submit: "enter"
  new_line: "ctrl+enter"
  clear_screen: "ctrl+l"
  retry: "ctrl+r"
  edit_last: "ctrl+e"
  save_session: "ctrl+s"
  load_session: "ctrl+o"
  toggle_tools: "ctrl+t"
  switch_model: "ctrl+m"
  history_up: "up"
  history_down: "down"

(3) Register Shortcuts in Code

PYTHON
from pi_agent import Agent

agent = Agent(name="custom")

@agent.keybind("ctrl+shift+r")
def retry_with_reasoner():
    agent.switch_model("deepseek-reasoner")
    agent.retry()

@agent.keybind("ctrl+shift+s")
def save_and_summarize():
    agent.session.save("auto_save.json")
    print("Session saved")

2. Theme Customization

(1) Built-in Themes

BASH
pi-agent config set theme dark
pi-agent config set theme light
pi-agent config set theme monokai
pi-agent config set theme solarized
pi-agent config set theme nord

(2) Switch in Interactive Mode

TEXT 📖 Display only
you> /theme dark
Theme switched to dark

(3) Custom Theme

Create ~/.pi-agent/themes/my_theme.yaml:

YAML
name: my_theme
background: "#1e1e2e"
foreground: "#cdd6f4"
accent: "#89b4fa"
error: "#f38ba8"
warning: "#fab387"
success: "#a6e3a1"
user_input: "#89dceb"
agent_output: "#cdd6f4"
tool_call: "#f9e2af"
code_block:
  background: "#313244"
  foreground: "#cdd6f4"
  keyword: "#cba6f7"
  string: "#a6e3a1"
  comment: "#6c7086"
  function: "#89b4fa"

Apply:

BASH
pi-agent config set theme my_theme

3. Output Format Customization

(1) Code Highlighting

YAML
display:
  code_highlight: true
  code_theme: "monokai"
  line_numbers: true
  wrap_lines: false

(2) Markdown Rendering

YAML
display:
  markdown_render: true
  table_render: true
  link_clickable: true

(3) Tool Call Display

YAML
display:
  show_tool_calls: true
  tool_call_format: "compact"  # compact | detailed | minimal
  show_thinking: false

4. Font & Layout

YAML
display:
  font_family: "JetBrains Mono"
  font_size: 14
  line_height: 1.5
  show_header: true
  show_token_count: true
  show_timestamp: false
  compact_mode: false
  max_width: 120

FAQ

Q Keybinding conflicts?
A Pi Agent's shortcuts have lower priority than terminal shortcuts. If they conflict, modify Pi Agent's keybinding config.
Q Theme not applying?
A Make sure the theme filename matches the config. Custom themes must be in ~/.pi-agent/themes/.
Q Emoji display issues in terminal?
A Ensure your terminal supports Unicode. Windows Terminal, iTerm2, and Alacritty all support it. Old cmd.exe may not.

Summary


Exercises

  1. Basic (Difficulty: ⭐): Switch between 3 built-in themes, pick your favorite.
  2. Intermediate (Difficulty: ⭐⭐): Create a custom theme with your preferred color scheme.
  3. Advanced (Difficulty: ⭐⭐⭐): Register shortcuts for one-key switching between "coding mode" and "reading mode" themes.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏