configuring-ghostty-vibe-stack

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ghostty Vibe Coding Stack

Ghostty 沉浸式编码工具栈

A complete terminal-based AI coding environment for macOS (Apple Silicon). Replaces heavy IDEs with lightweight, composable tools for Claude Code / AI-assisted development.
这是一款为搭载Apple Silicon的macOS打造的完整终端式AI编码环境。它用轻量、可组合的工具替代重型IDE,支持Claude Code / AI辅助开发。

Setup Workflow

搭建流程

Follow these steps in order. Skip steps where the tool is already installed.
Copy this checklist and track progress:
Setup Progress:
- [ ] Step 1: Pre-flight checks
- [ ] Step 2: Install Ghostty
- [ ] Step 3: Install CLI tools
- [ ] Step 4: Install fonts
- [ ] Step 5: Configure Ghostty
- [ ] Step 6: Configure Fish shell
- [ ] Step 7: Install Fish plugins
- [ ] Step 8: Configure lazygit
- [ ] Step 9: Configure yazi
- [ ] Step 10: Install Neovim + LazyVim
- [ ] Step 11: Set Ghostty as default terminal
- [ ] Step 12: Validate and verify
请按顺序执行以下步骤,若工具已安装可跳过对应步骤。
复制以下清单跟踪进度:
Setup Progress:
- [ ] Step 1: Pre-flight checks
- [ ] Step 2: Install Ghostty
- [ ] Step 3: Install CLI tools
- [ ] Step 4: Install fonts
- [ ] Step 5: Configure Ghostty
- [ ] Step 6: Configure Fish shell
- [ ] Step 7: Install Fish plugins
- [ ] Step 8: Configure lazygit
- [ ] Step 9: Configure yazi
- [ ] Step 10: Install Neovim + LazyVim
- [ ] Step 11: Set Ghostty as default terminal
- [ ] Step 12: Validate and verify

Step 1: Pre-flight Checks

步骤1:前置检查

Verify prerequisites before starting:
bash
undefined
开始前先验证必备条件:
bash
undefined

Check macOS and architecture

检查macOS版本和架构

uname -m # expect: arm64 sw_vers --productVersion # expect: 13.0+
uname -m # 预期输出:arm64 sw_vers --productVersion # 预期输出:13.0+

Check Homebrew

检查Homebrew

brew --version || echo "Homebrew not installed — install from https://brew.sh"

If Homebrew is missing, install it:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Check what is already installed to skip redundant steps:
bash
for cmd in ghostty fish yazi lazygit nvim fzf zoxide atuin fd rg bat delta; do
  printf "%-10s: " "$cmd"
  which $cmd 2>/dev/null || echo "not installed"
done
brew --version || echo "Homebrew未安装 — 请从https://brew.sh安装"

若未安装Homebrew,执行以下命令安装:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
检查已安装的工具以跳过重复步骤:
bash
for cmd in ghostty fish yazi lazygit nvim fzf zoxide atuin fd rg bat delta; do
  printf "%-10s: " "$cmd"
  which $cmd 2>/dev/null || echo "未安装"
done

Step 2: Install Ghostty

步骤2:安装Ghostty

Check if Ghostty is already installed:
bash
ls /Applications/Ghostty.app 2>/dev/null && echo "Ghostty installed" || echo "Not installed"
If not installed:
bash
brew install --cask ghostty
检查Ghostty是否已安装:
bash
ls /Applications/Ghostty.app 2>/dev/null && echo "Ghostty已安装" || echo "未安装"
若未安装:
bash
brew install --cask ghostty

Step 3: Install CLI Tools

步骤3:安装CLI工具

Install all tools in one command (already-installed tools are skipped automatically):
bash
brew install fish yazi lazygit neovim fzf zoxide atuin fd ripgrep bat git-delta
一键安装所有工具(已安装的工具会自动跳过):
bash
brew install fish yazi lazygit neovim fzf zoxide atuin fd ripgrep bat git-delta

Step 4: Install Fonts

步骤4:安装字体

Ask the user which font setup they prefer before installing:
Option A: CJK-optimized (recommended for Chinese/Japanese/Korean users)
bash
brew install --cask font-maple-mono-nf-cn font-sarasa-gothic font-jetbrains-mono-nerd-font
Option B: Latin-only (English-primary users)
bash
brew install --cask font-jetbrains-mono-nerd-font
安装前询问用户偏好的字体设置:
选项A:CJK优化版(推荐给中、日、韩用户)
bash
brew install --cask font-maple-mono-nf-cn font-sarasa-gothic font-jetbrains-mono-nerd-font
选项B:仅拉丁语系版(英文用户优先)
bash
brew install --cask font-jetbrains-mono-nerd-font

Step 5: Configure Ghostty

步骤5:配置Ghostty

Read the complete config template from references/ghostty-config.md.
Before writing, ask the user about preferences:
  • Theme: Run
    ghostty +list-themes
    to show options. Popular: Monokai Vivid, Rose Pine, TokyoNight Storm, Catppuccin Mocha
  • Transparency: Whether to enable background opacity (some users prefer fully opaque)
  • Font size: Default 15, adjust for their display
Write config to
~/.config/ghostty/config
:
bash
mkdir -p ~/.config/ghostty
After writing, ALWAYS validate:
bash
ghostty +validate-config
If validation shows theme errors, the theme name likely needs exact casing. Check with
ghostty +list-themes | grep -i <name>
.
references/ghostty-config.md读取完整配置模板。
写入配置前询问用户偏好:
  • 主题:执行
    ghostty +list-themes
    查看可选主题。热门选项:Monokai Vivid、Rose Pine、TokyoNight Storm、Catppuccin Mocha
  • 透明度:是否启用背景透明度(部分用户偏好完全不透明)
  • 字体大小:默认15号,可根据显示器调整
将配置写入
~/.config/ghostty/config
bash
mkdir -p ~/.config/ghostty
写入后务必验证配置:
bash
ghostty +validate-config
若验证显示主题错误,可能是主题名称大小写不匹配。执行
ghostty +list-themes | grep -i <name>
检查正确名称。

Step 6: Configure Fish Shell

步骤6:配置Fish Shell

Read the complete config template from references/fish-config.md.
Register Fish as an allowed shell (requires sudo — inform the user):
bash
grep -q "$(which fish)" /etc/shells || echo "$(which fish)" | sudo tee -a /etc/shells
Write config to
~/.config/fish/config.fish
:
bash
mkdir -p ~/.config/fish/{completions,conf.d,functions}
Import existing shell history into atuin:
bash
fish -c "atuin import auto"
references/fish-config.md读取完整配置模板。
将Fish注册为允许的shell(需要sudo权限,请告知用户):
bash
grep -q "$(which fish)" /etc/shells || echo "$(which fish)" | sudo tee -a /etc/shells
将配置写入
~/.config/fish/config.fish
bash
mkdir -p ~/.config/fish/{completions,conf.d,functions}
将现有shell历史导入atuin:
bash
fish -c "atuin import auto"

Step 7: Install Fish Plugins

步骤7:安装Fish插件

Check if Fisher (plugin manager) is installed:
bash
fish -c "type fisher" 2>/dev/null || fish -c "curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher"
Install Tide prompt:
bash
fish -c "fisher install IlanCosman/tide@v6"
检查Fisher(插件管理器)是否已安装:
bash
fish -c "type fisher" 2>/dev/null || fish -c "curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher"
安装Tide提示符:
bash
fish -c "fisher install IlanCosman/tide@v6"

Step 8: Configure lazygit

步骤8:配置lazygit

Read the complete config template from references/lazygit-config.md.
The reference includes color themes for Monokai, TokyoNight, and Rose Pine. Match the lazygit theme to whichever Ghostty theme the user chose in Step 5.
Write config to
~/.config/lazygit/config.yml
:
bash
mkdir -p ~/.config/lazygit
references/lazygit-config.md读取完整配置模板。
参考模板包含Monokai、TokyoNight和Rose Pine的颜色主题。将lazygit主题与用户在步骤5中选择的Ghostty主题保持一致。
将配置写入
~/.config/lazygit/config.yml
bash
mkdir -p ~/.config/lazygit

Step 9: Configure yazi

步骤9:配置yazi

Read the complete config template from references/yazi-config.md.
Write config to
~/.config/yazi/yazi.toml
:
bash
mkdir -p ~/.config/yazi
references/yazi-config.md读取完整配置模板。
将配置写入
~/.config/yazi/yazi.toml
bash
mkdir -p ~/.config/yazi

Step 10: Install Neovim + LazyVim

步骤10:安装Neovim + LazyVim

Check if nvim config already exists:
bash
ls ~/.config/nvim/init.lua 2>/dev/null && echo "Nvim config exists — skip or backup first" || echo "No config"
If no existing config:
bash
git clone https://github.com/LazyVim/starter ~/.config/nvim && rm -rf ~/.config/nvim/.git
If config exists, ask the user whether to backup and replace or skip.
Tell the user: first time opening
nvim
, LazyVim auto-installs all plugins — wait about 30 seconds.
检查nvim配置是否已存在:
bash
ls ~/.config/nvim/init.lua 2>/dev/null && echo "Nvim配置已存在 — 请先备份或跳过" || echo "无配置"
若没有现有配置:
bash
git clone https://github.com/LazyVim/starter ~/.config/nvim && rm -rf ~/.config/nvim/.git
若配置已存在,询问用户是否备份替换或跳过。
告知用户:首次打开
nvim
时,LazyVim会自动安装所有插件 — 请等待约30秒。

Step 11: Set Ghostty as Default Terminal (Optional)

步骤11:设置Ghostty为默认终端(可选)

Ask the user if they want Ghostty to replace their current default terminal in Finder's "Open in Terminal".
If yes, compile and run the Swift helper:
bash
cat << 'SWIFT' > /tmp/set_default_terminal.swift
import CoreServices
let result = LSSetDefaultRoleHandlerForContentType(
    "public.unix-executable" as CFString, .shell,
    "com.mitchellh.ghostty" as CFString)
print(result == 0 ? "Success: Ghostty set as default terminal" : "Failed: \(result)")
SWIFT
swiftc /tmp/set_default_terminal.swift -o /tmp/set_default_terminal && /tmp/set_default_terminal
rm -f /tmp/set_default_terminal.swift /tmp/set_default_terminal
询问用户是否希望Ghostty替换Finder中“在终端中打开”的当前默认终端。
若用户同意,编译并运行Swift辅助脚本:
bash
cat << 'SWIFT' > /tmp/set_default_terminal.swift
import CoreServices
let result = LSSetDefaultRoleHandlerForContentType(
    "public.unix-executable" as CFString, .shell,
    "com.mitchellh.ghostty" as CFString)
print(result == 0 ? "Success: Ghostty set as default terminal" : "Failed: \(result)")
SWIFT
swiftc /tmp/set_default_terminal.swift -o /tmp/set_default_terminal && /tmp/set_default_terminal
rm -f /tmp/set_default_terminal.swift /tmp/set_default_terminal

Step 12: Validate and Verify

步骤12:验证与确认

Run final verification:
bash
echo "=== Tool Versions ==="
for cmd in fish yazi lazygit nvim fzf zoxide atuin fd rg bat delta; do
  printf "%-10s: " "$cmd"
  $cmd --version 2>&1 | head -1
done

echo ""
echo "=== Ghostty Config ==="
ghostty +validate-config 2>&1 || echo "Config OK (no output = no errors)"

echo ""
echo "=== Fish Shell ==="
fish -c "echo Fish is working"
Present the user with a summary of what was installed and configured, plus the quick reference below.
执行最终验证:
bash
echo "=== 工具版本 ==="
for cmd in fish yazi lazygit nvim fzf zoxide atuin fd rg bat delta; do
  printf "%-10s: " "$cmd"
  $cmd --version 2>&1 | head -1
done

echo ""
echo "=== Ghostty配置 ==="
ghostty +validate-config 2>&1 || echo "配置正常(无输出即无错误)"

echo ""
echo "=== Fish Shell ==="
fish -c "echo Fish运行正常"
向用户展示已安装和配置的内容摘要,以及下方的快速参考。

Quick Reference

快速参考

AliasCommand
y
yazi (file manager)
yy
yazi with cd-on-exit
lg
lazygit
v
nvim
cc
claude
z <keyword>
zoxide smart cd
Ghostty ShortcutAction
Cmd+D
Vertical split
Cmd+Shift+D
Horizontal split
Cmd+Alt+Arrow
Navigate splits
Ctrl+`
Quick Terminal (global)
Fish KeyAction
Tab
Accept autosuggestion
Alt+Tab
Accept one word
Completion menu
Ctrl+R
History search (atuin)
别名命令
y
yazi(文件管理器)
yy
退出时自动切换目录的yazi
lg
lazygit
v
nvim
cc
claude
z <关键词>
zoxide智能跳转目录
Ghostty快捷键操作
Cmd+D
垂直分屏
Cmd+Shift+D
水平分屏
Cmd+Alt+方向键
切换分屏窗口
Ctrl+`
全局快速终端
Fish按键操作
Tab
接受自动建议
Alt+Tab
接受单个单词的自动建议
打开补全菜单
Ctrl+R
历史记录搜索(atuin)

Troubleshooting

问题排查

Theme names require exact casing with spaces:
  • Wrong:
    rose-pine
    ,
    tokyo-night
  • Correct:
    Rose Pine
    ,
    TokyoNight Storm
  • List available:
    ghostty +list-themes
  • Validate config:
    ghostty +validate-config
Cmd+V does not paste images into Claude Code (Ghostty bug, Discussion #10117):
  • Use
    Ctrl+V
    instead, or drag-and-drop image files
Fish key binding syntax differs from Zsh:
  • Wrong:
    bind -k right complete
    (
    -k
    is zsh syntax)
  • Correct:
    bind right complete
  • Also override raw escape:
    bind \e\[C complete
Chinese text too large or misaligned:
  • Add CJK font as first
    font-family
    entry
  • Set
    adjust-cell-height = 20%
List available fonts:
ghostty +list-fonts
List available themes:
ghostty +list-themes
主题名称需严格区分大小写且保留空格
  • 错误写法:
    rose-pine
    ,
    tokyo-night
  • 正确写法:
    Rose Pine
    ,
    TokyoNight Storm
  • 查看可用主题:
    ghostty +list-themes
  • 验证配置:
    ghostty +validate-config
Cmd+V无法将图片粘贴到Claude Code(Ghostty已知问题,讨论#10117):
  • 改用
    Ctrl+V
    ,或直接拖拽图片文件
Fish按键绑定语法与Zsh不同
  • 错误写法:
    bind -k right complete
    -k
    是zsh语法)
  • 正确写法:
    bind right complete
  • 同时需要覆盖原生转义:
    bind \e\[C complete
中文文本过大或对齐异常
  • 将CJK字体设为
    font-family
    的第一个条目
  • 设置
    adjust-cell-height = 20%
查看可用字体
ghostty +list-fonts
查看可用主题
ghostty +list-themes