
















【GIT】https://gitee.com/luojinzhi0108/Glean.git
【视频演示】 【【拾零】0 - 开箱即用的现代风终端】 https://www.bilibili.com/video/BV1YhoQBGEj6/?share_source=copy_web&vd_source=c6e72a4705f5de2407182db1367836d0
开箱即用的现代风:不用深度折腾,也能有顶级的效率和审美。
这是一套面向 macOS 开发者的终端方案,核心理念是开箱即用、高颜值、高效率。六个工具各司其职,十分钟内完成安装配置,无需手写复杂配置文件。
| 工具 | 角色 | 核心亮点 |
|---|---|---|
| Ghostty | 终端模拟器 | GPU 加速渲染、内置 100+ 主题、零配置启动 |
| Fish | Shell | 语法高亮、自动补全、历史建议全开箱自带 |
| Starship | 提示符 | 跨平台兼容,一行命令预设主题 |
| fzf | 模糊查找器 | 命令历史/文件/目录即时模糊匹配 |
| zoxide | 智能目录跳转 | 学习访问习惯,关键词秒跳目录 |
| Raycast | 效率启动器 | 取代 Spotlight,统一开发者工作流入口 |
# 如未安装 Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 验证
brew --version
必须先装字体。Starship 和 fzf 依赖特殊图标字符(Git 分支符号、文件夹图标、箭头分隔符等),普通字体无法显示,会变成乱码方块。
brew install font-meslo-lg-nerd-font
验证安装:
system_profiler SPFontsDataType | grep -i "meslo"
看到 MesloLGS NF 即表示成功。也可在 Font Book(字体册)中搜索 Meslo 确认。
brew install --cask ghostty
ghostty +list-themes
按 Esc 或 q 退出预览。
配置文件路径:~/Library/Application Support/com.mitchellh.ghostty/ghostty.config
mkdir -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 = cmd+alt+right=next_tab
keybind = cmd+alt+left=previous_tab
配置完成后 Cmd + Q 退出 Ghostty,重新打开使配置生效。
| 快捷键 | 功能 |
|---|---|
Cmd + D |
竖直分割 |
Cmd + Shift + D |
水平分割 |
Cmd + Option + 方向键 |
切换焦点窗格 |
输入 exit 或 Ctrl + D |
关闭当前窗格 |
brew install fish
# 确认安装路径
which fish
# 加入系统合法 Shell 列表
echo /opt/homebrew/bin/fish | sudo tee -a /etc/shells
# 设为默认
chsh -s /opt/homebrew/bin/fish
Cmd + Q 退出终端,重新打开。验证:
echo $SHELL
# 输出 /opt/homebrew/bin/fish
Fish 三大核心功能均为原生自带,无需安装任何插件:
→ 键接受brew install starship
mkdir -p ~/.config
starship preset tokyo-night -o ~/.config/starship.toml
命令无输出但已自动生成配置文件。可查看:
cat ~/.config/starship.toml
可选预设主题还包括:gruvbox-rainbow、catppuccin-powerline、pastel-powerline 等。
vim ~/.config/fish/config.fish
if status is-interactive
set -U fish_greeting
starship init fish | source
end
if status is-interactive是 Fish 推荐的结构,确保仅交互式会话加载配置,脚本执行时跳过以节省资源。
加载配置:
source ~/.config/fish/config.fish
提示符即刻生效。Starship 会自动显示:当前目录、Git 分支、编程语言版本(Node/Python/Go 等)、命令执行状态等信息。
brew install fzf
/opt/homebrew/opt/fzf/install
所有询问选 y。
# 确认安装
which fzf
fzf --version
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.fish
Mac 键盘上
Alt键即Option (⌥),Ctrl键即Control (⌃),不要与Cmd (⌘)混淆。
| 快捷键 | 功能 |
|---|---|
Ctrl + R |
模糊搜索命令历史 |
Ctrl + T |
模糊搜索当前目录文件 |
Alt + C |
模糊搜索并跳转目录 |
brew install zoxide
open -t ~/.config/fish/config.fish
在 fzf 配置下方添加:
# zoxide
zoxide init fish | source
保存后加载:
source ~/.config/fish/config.fish
z keyword # 跳转到历史访问过的最佳匹配目录
z keyword1 keyword2 # 匹配包含两个关键词的目录
zi # 交互式模糊选择(需 fzf 支持)
z - # 返回上一个目录
zoxide 在后台自动记录访问路径和频率,无需手动维护。
open -t ~/.config/fish/config.fish
在 zoxide 配置下方、end 之前添加:
# 别名
alias ll "ls -lh"
alias la "ls -lAh"
end
路径:~/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 = cmd+alt+right=next_tab
keybind = cmd+alt+left=previous_tab
路径:~/.config/fish/config.fish
if status is-interactive
set -U fish_greeting
starship init fish | source
# fzf
fzf --fish | source
set -gx FZF_CTRL_T_OPTS "--walker-skip .git,node_modules,target"
# zoxide
zoxide init fish | source
# 别名
alias ll "ls -lh"
alias la "ls -lAh"
end
路径:~/.config/starship.toml
由 starship preset tokyo-night 自动生成,无需手动编辑。
从 raycast.com 下载安装,将快捷键设为 Cmd + Space 以取代 Spotlight。
在 Raycast(Cmd + Space)中输入 Store 进入扩展商店:
brew install eza
# 添加到 config.fish 别名区,替换原有 ls 别名
alias ls "eza"
alias ll "eza -lh --git"
alias tree "eza --tree"
rm -f ~/Library/Application\ Support/com.mitchellh.ghostty/config.ghostty
# Cmd + Q 退出 Ghostty 重新打开即恢复出厂设置
| 功能 | 命令 |
|---|---|
| 预览所有主题 | ghostty +list-themes --preview |
| 查看当前主题 | ghostty +show-theme |
| 搜索文件 | fzf |
| 搜索历史 | history | fzf |
| 搜索目录 | cd (find . -type d | fzf) |
| 智能跳转 | z <关键词> |
| 交互式跳转 | zi |
| 返回上一目录 | z - |
Nerd Font → Ghostty → Fish → Starship → fzf → zoxide → 别名
↓ ↓ ↓ ↓ ↓ ↓
先装字体 Cmd+Q退出 临时进入 生成配置 装完 装完
后面引用 重开生效 演示完 再写配置 再追加 再追加
再改默认 source source source
原则:装一个工具 → 验证安装成功 → 追加配置 → source 加载 → 再装下一个。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。