Pi Agent: Keybindings & Theme Customization
最終更新:2026-08-31
--- title: "キーバインドとテーマカスタマイズ" description: "Pi AgentのキーボードショートカットとUIテーマをカスタマイズして、理想のAgent開発環境を構築します。" order: 9 lang: ja
道具は手に馴染んでこそ良い。キーバインドとテーマは「ワークステーションの調整」だ。
1. キーボードショートカット
(1) デフォルトショートカット
| ショートカット | 機能 |
|---|---|
| Ctrl+C | 現在の操作を中断 / 終了 |
| Ctrl+D | インタラクティブモードを終了 |
| Enter | メッセージを送信 |
| Ctrl+L | 画面をクリア |
| Tab | 自動補完(コマンド/ファイル名) |
| Up/Down | メッセージ履歴を閲覧 |
| Ctrl+R | 最後のレスポンスを再生成 |
| Ctrl+E | 最後のメッセージを編集 |
| Ctrl+K | 行末まで削除 |
(2) カスタムショートカット
~/.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) コードでショートカットを登録
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. テーマカスタマイズ
(1) 組み込みテーマ
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) インタラクティブモードで切り替え
TEXT
📖 参照専用
you> /theme dark
Theme switched to dark
(3) カスタムテーマ
~/.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"
適用:
BASH
pi-agent config set theme my_theme
3. 出力形式のカスタマイズ
(1) コードハイライト
YAML
display:
code_highlight: true
code_theme: "monokai"
line_numbers: true
wrap_lines: false
(2) Markdownレンダリング
YAML
display:
markdown_render: true
table_render: true
link_clickable: true
(3) ツール呼び出しの表示
YAML
display:
show_tool_calls: true
tool_call_format: "compact" # compact | detailed | minimal
show_thinking: false
4. フォントとレイアウト
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
❓ よくある質問
Q キーバインドが競合する?
A Pi Agentのショートカットはターミナルのショートカットより優先度が低いです。競合する場合は、Pi Agentのキーバインド設定を変更してください。
Q テーマが適用されない?
A テーマのファイル名が設定と一致していることを確認してください。カスタムテーマは
~/.pi-agent/themes/に配置する必要があります。Q ターミナルで絵文字が正しく表示されない?
A ターミナルがUnicodeをサポートしていることを確認してください。Windows Terminal、iTerm2、Alacrittyは対応しています。古いcmd.exeは非対応の場合があります。
📖 まとめ
- デフォルトショートカットは一般的な操作をカバー;keybindings.yamlでカスタマイズ可能
- 5つの組み込みテーマ;完全なカスタムカラースキームをサポート
- 出力形式の設定可能:コードハイライト、Markdownレンダリング、ツール呼び出し表示
- フォントとレイアウトのオプションで読みやすさを最適化
📝 練習問題
- 基礎(難易度:⭐): 3つの組み込みテーマを切り替えて、お気に入りを選んでください。
- 中級(難易度:⭐⭐): お好みのカラースキームでカスタムテーマを作成してください。
- 上級(難易度:⭐⭐⭐): 「コーディングモード」と「リーディングモード」のテーマをワンキーで切り替えるショートカットを登録してください。