适用环境

  • Windows 11
  • Windows Terminal
  • PowerShell 7
  • Claude Code
  • OpenAI Codex
  • Git

很多人在使用 Claude Code 或 Codex 时,会发现终端输出虽然功能强大,但默认界面比较普通,长时间阅读日志、代码变更和执行结果比较费劲。

本文将搭建一套现代化 AI 编程终端环境,包括:

  • 更漂亮的终端界面
  • 更好的字体显示
  • Git 状态提示
  • 文件图标
  • Claude Code / Codex 输出统一风格
  • PowerShell 智能补全

最终效果类似现代 AI IDE(Cursor、Warp)的终端体验。


一、最终效果

配置完成后,将获得:

  • ✅ Windows Terminal
  • ✅ PowerShell 7
  • ✅ JetBrainsMono Nerd Font
  • ✅ Oh My Posh
  • ✅ Terminal Icons
  • ✅ PSReadLine
  • ✅ Claude Code Terminal UI Skill
  • ✅ Codex Output Style

效果示例:

══════════════════════════════════════════════
🚀 Build Project
══════════════════════════════════════════════

✓ Restore packages

✓ Compile source

✓ Run unit tests

✓ Build succeeded

──────────────────────────────────────────────

Summary

Files changed : 12

Tests passed  : 168

Duration      : 42s

Status        : SUCCESS

二、第一步:美化 PowerShell

① 安装 Windows Terminal

推荐使用 Windows Terminal,不建议继续使用 Windows 自带的 Windows PowerShell。

安装方式:

Microsoft Store 搜索:

Windows Terminal

或者使用:

winget install Microsoft.WindowsTerminal

安装完成后建议设置为默认终端。


② 安装 PowerShell 7

Windows 自带的是 PowerShell 5.1,两者是独立的软件。

安装:

winget install Microsoft.PowerShell

查看版本:

$PSVersionTable.PSVersion

应看到:

Major Minor Patch
----- ----- -----
7.x.x

以后建议始终使用:

pwsh

而不是:

powershell

③ 安装 Nerd Font(最重要)

推荐字体:

JetBrainsMono Nerd Font

一键安装:

winget install --id DEVCOM.JetBrainsMonoNerdFont

安装完成后,打开 Windows Terminal → 设置 → 默认值 → 外观 → 字体,选择:

JetBrainsMono Nerd Font

如果找不到,可在字体下拉框中搜索 JetBrains

提示:不同版本的 Windows Terminal 界面略有差异,如果找不到 "设置 → 默认值 → 外观 → 字体",可以直接修改 JSON 配置文件。

Ctrl + Shift + , 打开 Windows Terminal 设置,然后点击左下角 "打开 JSON 文件"(部分版本显示为 "打开设置(JSON)"),在 profiles.defaults 中添加或修改字体配置:

{
    "profiles": {
        "defaults": {
            "font": {
                "face": "JetBrainsMono Nerd Font",
                "size": 12
            }
        }
    }
}

保存后,关闭并重新打开 Windows Terminal 即可生效。

注意:

如果提示 "找不到以下字体:JetBrainsMono Nerd Font",请确认已经安装了 Nerd Font,而不是普通版 JetBrains Mono。可以使用以下命令快速安装:

winget install --id DEVCOM.JetBrainsMonoNerdFont

安装完成后重新启动 Windows Terminal,再将字体设置为 JetBrainsMono Nerd Font

安装 Nerd Font 后,可以正确显示:

  • Powerline 图标
  • Git 图标
  • 文件夹图标
  • Unicode Box Drawing
  • Claude Code Dashboard

④ 安装 Oh My Posh(推荐)

Oh My Posh 可以让 PowerShell 拥有现代化 Prompt。

安装:

winget install JanDeDobbeleer.OhMyPosh

打开 Profile:

notepad $PROFILE

如果提示文件不存在,可先执行:

New-Item -ItemType File -Force $PROFILE

然后加入:

oh-my-posh init pwsh | Invoke-Expression

重新打开终端即可。


三、第二步:配置 Claude Code Skill

建议新建一个 Terminal UI Skill

目录结构:

.claude/
└── skills/
    └── terminal-ui/
        └── skill.md

skill.md 示例:

# Terminal UI

Always render terminal output in a professional CLI style.

Rules

- Use UTF-8 box drawing.
- Prefer tables instead of bullets.
- Align all columns.
- Use ✓ ✗ ⚠ ⏳ icons.
- Use tree structure for files.
- Commands must be inside code blocks.
- Separate logs from summaries.
- Keep responses concise.
- End with a dashboard.

Maximum width: 90 characters.

配置完成后,Claude Code 输出会更加整洁、美观。


四、第三步:配置 Codex 输出风格

建议在项目根目录创建或修改提示文件(例如 AGENTS.md,具体取决于你使用的 Codex 工具)。

加入统一输出规范,例如:

## Output Style

Always render responses using a professional terminal layout.

Requirements

- Unicode borders
- Markdown tables
- Tree structures
- Compact summaries
- Dashboard at the end
- Avoid unnecessary long paragraphs

这样可以让 Codex 与 Claude Code 保持一致的终端风格。


五、第四步:安装 PowerShell 模块

Terminal-Icons

安装:

Install-Module Terminal-Icons -Scope CurrentUser

导入:

Import-Module Terminal-Icons

建议写入 Profile:

Import-Module Terminal-Icons

以后执行:

ls

即可显示文件图标。


PSReadLine

安装:

Install-Module PSReadLine -Scope CurrentUser

导入:

Import-Module PSReadLine

推荐配置:

Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView

功能包括:

  • 命令历史预测
  • 语法高亮
  • 智能补全
  • Ctrl + R 历史搜索

六、推荐的 Windows Terminal 配置

建议使用以下配置:

{
    "profiles": {
        "defaults": {
            "font": {
                "face": "JetBrainsMono Nerd Font",
                "size": 12
            }
        }
    }
}

可根据个人喜好调整字号。


七、推荐的开发环境组合

组件 推荐
终端 Windows Terminal
Shell PowerShell 7
字体 JetBrainsMono Nerd Font
Prompt Oh My Posh
文件图标 Terminal-Icons
命令增强 PSReadLine
AI 编程 Claude Code
AI 编程 Codex

八、总结

通过以上配置,可以获得一套适用于 Windows 的现代 AI 编程终端:

  • Windows Terminal:替代传统控制台,支持标签页、分屏和丰富的自定义。
  • PowerShell 7:性能更好、跨平台、兼容现代开发工具。
  • JetBrainsMono Nerd Font:提供完整的图标和 Unicode 字符支持。
  • Oh My Posh:美化命令提示符,集成 Git 状态和主题。
  • Terminal-Icons:让目录和文件显示直观图标。
  • PSReadLine:增强命令补全、历史记录和编辑体验。
  • Claude Code / Codex Skill:统一 AI 输出风格,提高日志、代码变更和执行结果的可读性。

这套配置兼顾美观、兼容性和实用性,非常适合作为 Windows 平台上的 AI 编程终端基础环境。

Logo

一站式 AI 云服务平台

更多推荐