zsh-history-substring-search for Mac 版
Fish shell 历史搜索的 Zsh 移植
zsh-history-substring-search 是什么
zsh-history-substring-search 是 Fish shell 历史搜索功能的净室实现,为 ZSH 用户带来更灵活的 history 检索体验。在原生 ZSH 中,历史搜索通常只能匹配命令开头;而这个插件允许你输入历史命令中的任意片段,再按预设按键(通常是上下方向键)在匹配结果间循环切换,快速定位目标命令。它需要 ZSH 4.3 或更新版本,可通过 Homebrew、Oh My Zsh、zplug、antigen、Zinit 等常见方式加载,也支持与 zsh-syntax-highlighting 配合使用(需注意加载顺序)。对于经常在终端里翻找旧命令、希望减少重复输入、提升交互效率的 ZSH 用户来说,这个插件用很小的配置成本换来了更接近 Fish 的顺滑搜索体验,尤其适合已经使用 Oh My Zsh 或类似框架、愿意微调键位绑定的开发者。
如何安装 zsh-history-substring-search
- 打开 终端(按 ⌘ + 空格,输入“终端”)。
- 如果还没安装 Homebrew,先运行下面这条安装命令。
- 运行下面这条命令:
最近 10 个版本记录
最近一次更新为 2023-07-28,当前版本 v1.1.0,共记录最近 3 个版本。
| 版本 | 发布日期 | 类型 | 大小 | macOS | Windows | Linux |
|---|---|---|---|---|---|---|
| v1.1.0 | 2023-07-28 | 稳定版 | — | — | — | — |
| v1.0.2 | 2019-10-26 | 稳定版 | — | — | — | — |
| v1.0.1 | 2017-02-28 | 稳定版 | — | — | — | — |
数据来自 GitHub Releases,稳定版优先,同类按发布时间排序。
二进制包支持平台
Homebrew 官方提供的预编译包(bottle)覆盖:
- all
⚠️ 未提供 Intel Mac 的预编译包,Intel 机型需要通过 brew install --build-from-source 从源码编译。
安装注意事项
To activate the history search, add the following at the end of your .zshrc:nn source $HOMEBREW_PREFIX/share/zsh-history-substring-search/zsh-history-substring-search.zshnnYou will also need to restart your terminal for this change to take effect.n
与同类应用对比
只对比公开元数据,不做主观推荐;需要逐项对比时见对比页。
| 应用 | 版本 | 许可证 | 架构 | 近 30 天安装 |
|---|---|---|---|---|
| zsh-history-substring-search | v1.1.0 | BSD-3-Clause | 命令行 | 322 |
| zinit | v3.17.1 | MIT | 命令行 | 177 |
| autojump | 22.5.3 | GPL-3.0-or-later | 命令行 | 306 |
| jiratui | 1.18.0 | MIT | 命令行 | 438 |