Ghostty + Fish + Starship + fzf + zoxide + Raycast

Ghostty + Fish + Starship + fzf + zoxide + Raycast 概述这是一套面向 macOS 开发者的终端方案核心理念是开箱即用、高颜值、高效率。六个工具各司其职十分钟内完成安装配置无需手写复杂配置文件。工具链工具角色核心亮点Ghostty终端模拟器GPU 加速渲染、内置 100 主题、零配置启动FishShell语法高亮、自动补全、历史建议全开箱自带Starship提示符跨平台兼容一行命令预设主题fzf模糊查找器命令历史/文件/目录即时模糊匹配zoxide智能目录跳转学习访问习惯关键词秒跳目录Raycast效率启动器取代 Spotlight统一开发者工作流入口二、前置条件macOS 系统已安装 Homebrew# 如未安装 Homebrew /bin/bash -c $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh) # 验证 brew --version三、安装步骤1. 安装 Nerd Font必须先装字体。Starship 和 fzf 依赖特殊图标字符Git 分支符号、文件夹图标、箭头分隔符等普通字体无法显示会变成乱码方块。brew install font-meslo-lg-nerd-font验证安装system_profiler SPFontsDataType | grep -i meslo看到MesloLGS NF即表示成功。也可在 Font Book字体册中搜索Meslo确认。2. 安装 Ghosttybrew install --cask ghostty2.1 预览内置主题ghostty list-themes按Esc或q退出预览。2.2 创建配置文件配置文件路径~/Library/Application Support/com.mitchellh.ghostty/ghostty.configmkdir -p ~/Library/Application\ Support/com.mitchellh.ghostty vim ~/Library/Application\ Support/com.mitchellh.ghostty/config.ghostty theme tokyonight font-family MesloLGS NF font-size 14 font-thicken true background-opacity 0.95 background-blur true window-padding-x 10 window-padding-y 5 keybind cmdaltrightnext_tab keybind cmdaltleftprevious_tab配置完成后Cmd Q 退出 Ghostty重新打开使配置生效。2.3 分屏快捷键快捷键功能Cmd D竖直分割Cmd Shift D水平分割Cmd Option 方向键切换焦点窗格输入exit或Ctrl D关闭当前窗格3. 安装 Fish Shellbrew install fish3.1 设为默认 Shell# 确认安装路径 which fish # 加入系统合法 Shell 列表 echo /opt/homebrew/bin/fish | sudo tee -a /etc/shells # 设为默认 chsh -s /opt/homebrew/bin/fishCmd Q 退出终端重新打开。验证echo $SHELL # 输出 /opt/homebrew/bin/fish3.2 Fish 核心特性Fish 三大核心功能均为原生自带无需安装任何插件语法高亮输入命令时自动对命令、参数、字符串进行着色自动建议基于历史记录给出灰色建议文本按→键接受智能补全Tab 补全带文字描述信息量远超 Bash/Zsh4. 安装 Starshipbrew install starship4.1 一键生成预设主题mkdir -p ~/.config starship preset tokyo-night -o ~/.config/starship.toml命令无输出但已自动生成配置文件。可查看cat ~/.config/starship.toml可选预设主题还包括gruvbox-rainbow、catppuccin-powerline、pastel-powerline等。4.2 创建 Fish 配置并加载 Starshipvim ~/.config/fish/config.fish if status is-interactive set -U fish_greeting starship init fish | source endif status is-interactive是 Fish 推荐的结构确保仅交互式会话加载配置脚本执行时跳过以节省资源。加载配置source ~/.config/fish/config.fish提示符即刻生效。Starship 会自动显示当前目录、Git 分支、编程语言版本Node/Python/Go 等、命令执行状态等信息。5. 安装 fzfbrew install fzf5.1 运行安装脚本/opt/homebrew/opt/fzf/install所有询问选y。5.2 处理路径问题如需要# 确认安装 which fzf fzf --version5.3 追加 fzf 配置open -t ~/.config/fish/config.fish在starship init fish | source和end之间添加# fzf fzf --fish | source set -gx FZF_CTRL_T_OPTS --walker-skip .git,node_modules,target保存后加载source ~/.config/fish/config.fish5.4 快捷键说明Mac 键盘上Alt键即Option (⌥)Ctrl键即Control (⌃)不要与Cmd (⌘)混淆。快捷键功能Ctrl R模糊搜索命令历史Ctrl T模糊搜索当前目录文件Alt C模糊搜索并跳转目录6. 安装 zoxidebrew install zoxide6.1 追加配置open -t ~/.config/fish/config.fish在 fzf 配置下方添加# zoxide zoxide init fish | source保存后加载source ~/.config/fish/config.fish6.2 使用方法z keyword # 跳转到历史访问过的最佳匹配目录 z keyword1 keyword2 # 匹配包含两个关键词的目录 zi # 交互式模糊选择需 fzf 支持 z - # 返回上一个目录zoxide 在后台自动记录访问路径和频率无需手动维护。7. 追加别名open -t ~/.config/fish/config.fish在 zoxide 配置下方、end之前添加# 别名 alias ll ls -lh alias la ls -lAh end四、最终配置文件Ghostty 配置