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

与其他终端对比

特性GhosttyWarpWindows Terminal
开发语言ZigRustC++
原生 UI
AI 功能内置
跨平台Mac/LinuxWin/Mac/Linux仅 Windows
开源完全开源部分
配置方式文本文件GUIJSON

安装方式

# 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

相关文档