折腾终端不是为了好看——好看只是副作用。这篇分享我目前稳定使用的四个工具,每个管一层,互不干涉。
不用 oh-my-zsh 一把梭了。拆开来,每层用最合适的:
三个 Rust,一个 Zig。启动都在毫秒级。
HashiCorp 创始人 Mitchell Hashimoto 做的终端模拟器,2024 年底开源。Zig 写的,GPU 渲染(macOS 用 Metal,Linux 用 OpenGL)。
跟 Alacritty 的核心区别:Ghostty 在每个平台都用原生 UI 框架。macOS 是 SwiftUI,Linux 是 GTK4。所以标签页、分屏这些操作跟系统行为完全一致,不用重新学快捷键。
几个亮点:
安装:brew install --cask ghostty
官网:https://ghostty.org GitHub:https://github.com/ghostty-org/ghostty(46k+ star) Mitchell Hashimoto 的架构介绍文:https://mitchellh.com/writing/ghostty-and-useful-zig-patterns
Rust 写的 shell 插件管理器,只做一件事:从 GitHub 下载插件,生成 source 脚本。配置是 TOML,声明式。
跟 oh-my-zsh / zinit 的区别:Sheldon 不接管你的 shell 环境,只管下载和加载。.zshrc 里只需要一行 eval "$(sheldon source)"。
安装:brew install sheldon
~/.config/sheldon/plugins.toml:
`shell = "zsh"
[plugins.zsh-autosuggestions]
github = "zsh-users/zsh-autosuggestions"
use = ["{{ name }}.zsh"]
[plugins.zsh-syntax-highlighting]
github = "zsh-users/zsh-syntax-highlighting"
[plugins.zsh-completions]
github = "zsh-users/zsh-completions"`
三个插件分别提供:历史命令灰色建议、输入时实时语法高亮、更多命令的补全规则。并行下载,lock 文件缓存,加载很快。
官网:https://sheldon.cli.rs GitHub:https://github.com/rossmacarthur/sheldon
Rust 写的跨 shell prompt,替换掉默认的命令行提示符。核心思路:只在需要时显示信息。 进 Git 仓库才显示分支,进 Python 项目才显示版本,进 K8s 上下文才显示集群名。不在对应环境就是一个干净的箭头。
50+ 内置模块,渲染速度 10ms 以内。一个 ~/.config/starship.toml 文件管所有配置,跨 Bash/Zsh/Fish/PowerShell 通用。
安装:brew install starship
.zshrc 加一行:eval "$(starship init zsh)"
官网:https://starship.rs GitHub:https://github.com/starship/starship(46k+ star) 预设主题列表(每个都有截图):https://starship.rs/presets/
AWS 出品的命令行 AI 补全工具(前身是Fig)。我只用它的一个功能:inline suggestions。
开启后,AI 根据当前输入和上下文推测你接下来要打的内容。可快速选择。``
跟 zsh-autosuggestions 的区别:autosuggestions 是本地历史匹配,Kiro inline 是云端 AI 推理。````
安装:
`curl -fsSL https://cli.kiro.dev/install | bash
kiro-cli login
kiro-cli inline enable`
官网:https://kiro.dev/cli inline 功能文档:https://kiro.dev/docs/cli/autocomplete/
`# Sheldon 加载插件
eval "$(sheldon source)"
# Starship prompt
eval "$(starship init zsh)"`
三行。Ghostty 是终端本身,装好不用配置。Kiro inline 装完 enable 一次就行。
如果你用 oh-my-zsh 用得好好的,没问题,不用折腾。但如果你:
可以挨个试。先换 Ghostty感受原生 UI,再加 Starship 看一眼提示符,然后 Sheldon 管插件,最后 Kiro inline 锦上添花。
本文转载自微信公众号,如有侵权请联系删除。