﻿---
title: "TUI 主题、Vim 模式和 shell 补全一起配"
summary: "/theme 写入 tui.theme；自定义 .tmTheme 放 $CODEX_HOME/themes。zsh 先 compinit 再加载 codex completion。"
category: commands
level: starter
surfaces: [cli]
tags: ["/theme", "/vim", "completion"]
canonical: /tips/theme-and-completion/
---

# TUI 主题、Vim 模式和 shell 补全一起配

/theme 写入 tui.theme；自定义 .tmTheme 放 $CODEX_HOME/themes。zsh 先 compinit 再加载 codex completion。

语法高亮（围栏代码块和 diff）：

```text
/theme
```

选中后写入 `tui.theme`。自定义主题把 TextMate `*.tmTheme` 放到 `$CODEX_HOME/themes`，再从选择器里挑。

Composer 想用 Vim 键：

```text
/vim
```

新会话默认开 Vim 模式：

```toml
[tui]
vim_mode_default = true
```

长提示仍用 Ctrl+G 交给 `$VISUAL` / `$EDITOR`。

Shell 补全：

```bash
codex completion zsh
```

zsh 若报 `command not found: compdef`，先初始化补全再加载：

```bash
autoload -Uz compinit && compinit
eval "$(codex completion zsh)"
```

也支持 `bash`、`fish`、`powershell`。改完重启 shell，输入 `codex` 再按 Tab 验证。

## 来源

- [OpenAI · CLI customization](https://learn.chatgpt.com/docs/cli-customization)
- [OpenAI · Developer commands](https://learn.chatgpt.com/docs/developer-commands)
