Ghostty
Ghostty 是由 HashiCorp 创始人 Mitchell Hashimoto 开发的开源终端模拟器,用 Zig 语言编写,以极致性能、原生 UI 和零妥协的标准兼容性为核心目标,支持 macOS 和 Linux。
核心特点
- 原生 UI:macOS 使用 SwiftUI,Linux 使用 GTK4,外观与系统完全融合
- 极致性能:GPU 加速渲染,启动速度极快
- 标准兼容:完整支持 xterm-256color、真彩色、Unicode、ligatures
- 零依赖配置:单一配置文件,语法简洁
配置文件
配置文件位于 ~/.config/ghostty/config(macOS 为 ~/Library/Application Support/com.mitchellh.ghostty/config)。
常用配置
# 字体
font-family = "JetBrains Mono"
font-size = 14
# 主题(内置 250+ 主题)
theme = catppuccin-mocha
# 透明度
background-opacity = 0.95
# 窗口
window-padding-x = 8
window-padding-y = 8
window-decoration = false
# Shell 集成
shell-integration = zsh
# 光标
cursor-style = bar
cursor-style-blink = true快捷键自定义
# 格式:keybind = trigger=action
keybind = ctrl+shift+t=new_tab
keybind = ctrl+shift+w=close_surface
keybind = ctrl+shift+enter=new_split:right常用快捷键
| 操作 | 快捷键(macOS) |
|---|---|
| 新建标签页 | Cmd+T |
| 关闭标签页 | Cmd+W |
| 切换标签页 | Cmd+1~9 |
| 水平分屏 | Cmd+D |
| 垂直分屏 | Cmd+Shift+D |
| 切换分屏 | Cmd+[ / Cmd+] |
| 全屏 | Cmd+Enter |
| 放大字体 | Cmd+= |
| 缩小字体 | Cmd+- |
| 命令面板 | Cmd+Shift+P |
Linux 下将 Cmd 替换为 Ctrl。
Shell 集成
Ghostty 内置 Shell 集成,支持 bash、zsh、fish,配置 shell-integration = zsh 后自动生效:
- 语义化命令提示符(可跳转到上一命令)
- 命令执行时间显示
- 当前目录追踪
- 复制上一命令输出
内置主题
Ghostty 内置 250+ 主题,可通过命令预览:
# 列出所有主题
ghostty +list-themes
# 常用主题
# catppuccin-mocha / catppuccin-latte
# dracula
# nord
# solarized-dark / solarized-light
# tokyo-night
# gruvbox-dark与其他终端对比
| 特性 | Ghostty | Warp | Windows Terminal |
|---|---|---|---|
| 开发语言 | Zig | Rust | C++ |
| 原生 UI | 是 | 否 | 否 |
| AI 功能 | 无 | 内置 | 无 |
| 跨平台 | Mac/Linux | Win/Mac/Linux | 仅 Windows |
| 开源 | 完全开源 | 部分 | 是 |
| 配置方式 | 文本文件 | GUI | JSON |
安装方式
# macOS(Homebrew)
brew install --cask ghostty
# Arch Linux
yay -S ghostty
# 源码编译(需要 Zig 0.13+)
git clone https://github.com/ghostty-org/ghostty
cd ghostty
zig build -p /usr/local -Doptimize=ReleaseFast