捂脸斋

江山风月 🌘 本无常主 🌈 闲者便是主人 🍃🍃🍃

推荐几个常用的 zsh 插件

推荐几个好用的 zsh 插件,安装以 Oh My Zsh 为例。

zsh-autosuggestions

自动补全插件,必备单品。

image-20221103060959846

输入部分命令,按方向键右➡️。

安装
1
omz plugin enable zsh-autosuggestions

zsh-syntax-highlighting

高亮插件,必备单品。

安装
1
omz plugin enable zsh-syntax-highlighting

gitignore

一行命令自动下载 gitignore 模板,简化了新建项目时配置 gitignore 的麻烦。

使用
1
2
gi python > python.ignore
gi java > java.ignore

插件会自动下载对应的模板文件到指定文件。

安装
1
omz plugin enable gitignore

git-open

通过命令打开 git repository 的 web 页面,目前支持以下 hosts。

  • github.com
  • gist.github.com
  • gitlab.com
  • GitLab custom hosted (see below)
  • bitbucket.org
  • Atlassian Bitbucket Server (formerly Atlassian Stash)
  • Visual Studio Team Services
  • Team Foundation Server (on-premises)
  • AWS Code Commit
使用
1
2
3
# cd 到某个 git 项目下
git open
# 会调用浏览器打开对应的 web 页面
安装
1
2
3
git clone https://github.com/paulirish/git-open.git $ZSH_CUSTOM/plugins/git-open
# e.g. git clone https://github.com/paulirish/git-open.git ~/.oh-my-zsh/plugins/git-open
omz plugin enable git-open

hitokoto/rand-quote

hitokoto.cnRandom Quotes 随机获取一句话,配合 cowsay 使用,可在每次启动 zsh 时让小牛对你打招呼~~

image-20221103070404304
安装及配置
  1. 安装 hitokoto 或 rand-quote

    1
    2
    3
    omz plugin enable hitokoto
    # or
    omz plugin enable rand-quote

​ 注意:这两个插件装一个即可。hitokoto 提供的是中文社区的句子,rand-quote 提供的是英文社区的句子。

  1. 安装 cowsay

    1
    2
    3
    brew install cowsay
    # or
    npm install -g cowsay
  2. 在 .zshrc 最后一行添加

    1
    2
    3
    quote | cowsay
    # or
    hitokoto | cowsay

使用命令直接搜索 google/baidu/github 等网站。

使用
1
2
3
4
github web-search
google hello
baidu 你好
...

具体支持的网站可使用 omz plugin info web-search 查询。

安装
1
omz plugin enable web-search

z

快速跳转到常用的目录。

image-20221103071137053
安装
1
omz plugin enable z