zsh安装插件

0

zsh不仅在外观上比较美观,而且其具有强大的插件,如果不使用那就亏大了。

官方插件库

https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins

官方插件库并不一定有所有的插件,比如zsh-autosuggestions插件就不再列表里,下面演示zsh-autosuggestions插件的安装。

变量

$ZSH_CUSTOM

cpp 复制代码
❯ echo $ZSH_CUSTOM           
/home/ying/.oh-my-zsh/custom

1 安装自动提示插件(zsh-autosuggestions)

1.执行

git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

2.编辑 ~/.zshrc 文件

plugins=(git zsh-autosuggestions)

3.使配置生效

source ~/.zshrc

重启终端程序就可以使用了!

2 常用插件推荐

以下是一些常用的 Zsh 插件,它们能够显著提升终端使用体验:

1. zsh-autosuggestions

  • 功能:自动提示命令历史中的匹配内容,可以提高命令行输入效率。

  • 安装

    bash 复制代码
    git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

2. zsh-syntax-highlighting

  • 功能:为命令行语法添加高亮显示,使命令更容易阅读和识别错误。

  • 安装

    bash 复制代码
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

3. zsh-completions

  • 功能:增加许多额外的命令补全选项,提升命令输入体验。

  • 安装

    bash 复制代码
    git clone https://github.com/zsh-users/zsh-completions.git $ZSH_CUSTOM/plugins/zsh-completions

4. git

  • 功能:为 Git 命令提供自动补全和别名,简化 Git 操作。
  • 已包含:这是 Oh My Zsh 的内建插件,默认启用。
  • 功能:通过输入部分命令来快速搜索历史命令,特别适合用于频繁输入的命令。

  • 安装

    bash 复制代码
    git clone https://github.com/zsh-users/zsh-history-substring-search.git $ZSH_CUSTOM/plugins/zsh-history-substring-search

6. fzf

  • 功能 :集成 fzf(命令行模糊搜索工具)来提高文件、命令和历史的搜索效率。

  • 安装

    bash 复制代码
    git clone https://github.com/junegunn/fzf.git ~/.fzf
    ~/.fzf/install

7. zsh-navigation-tools

  • 功能:提供键盘快捷键和其他导航功能,使得在文件系统中快速移动更加方便。

  • 安装

    bash 复制代码
    git clone https://github.com/psprint/zsh-navigation-tools.git $ZSH_CUSTOM/plugins/zsh-navigation-tools

8. alias-finder

  • 功能:帮助你找到并使用已有的别名,特别适合有很多命令别名的用户。

  • 安装

    bash 复制代码
    git clone https://github.com/rafi/alias-finder.git $ZSH_CUSTOM/plugins/alias-finder

9. zsh-fast-syntax-highlighting

  • 功能:提供快速的命令语法高亮,减少命令输入的视觉负担。

  • 安装

    bash 复制代码
    git clone https://github.com/zdharma/zsh-fast-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-fast-syntax-highlighting

10. docker

  • 功能:为 Docker 命令提供补全和别名支持。

  • 安装

    bash 复制代码
    git clone https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker $ZSH_CUSTOM/plugins/docker

如何启用插件

  1. 编辑 ~/.zshrc 文件

    找到 plugins 配置项,添加你需要的插件名称。例如:

    bash 复制代码
    plugins=(git zsh-autosuggestions zsh-syntax-highlighting fzf)
  2. 重新加载配置

    修改完 ~/.zshrc 文件后,使用以下命令使更改生效:

    bash 复制代码
    source ~/.zshrc

这些插件可以大大提升你在 Zsh 中的效率和使用体验!

下载命令模板

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

目录

oh-my-zsh插件

/home/ying/.oh-my-zsh/plugins

第三方

/home/ying/.oh-my-zsh/custom/plugins

相关推荐
l1t4 天前
用parser_tools插件来解析SQL语句
数据库·sql·插件·duckdb
lypzcgf11 天前
Coze源码分析-资源库-编辑插件-后端源码-领域/数据访问层
系统架构·插件·coze·coze源码分析·智能体平台·ai应用平台·agent平台
l1t12 天前
在duckdb 1.4中编译和使用postgresql协议插件duckdb-pgwire
开发语言·数据库·c++·postgresql·插件·duckdb
lypzcgf12 天前
Coze源码分析-资源库-编辑插件-后端源码-安全与错误处理
安全·插件·coze·coze源码分析·智能体平台·ai应用平台·agent平台
努力还债的学术吗喽12 天前
pycharm找不到Tencent Cloud CodeBuddy如何安装[windows]?pycharm插件市场找不到插件如何安装?
ide·windows·pycharm·插件·plugin·codebuddy
l1t12 天前
编译Duckdb机器学习插件QuackML
数据库·c++·人工智能·机器学习·插件·duckdb
l1t13 天前
DuckDB 的postgresql插件无法访问GooseDB
数据库·postgresql·插件·duckdb
lypzcgf13 天前
Coze源码分析-资源库-编辑插件-后端源码-核心技术与总结
系统架构·插件·coze·coze源码分析·智能体平台·ai应用平台·agent平台
hi啦克14 天前
macOS 下安装 zsh、zsh-syntax-highlighting、powerlevel9k、nerd-font
macos·zsh·语法高亮·powerlevel9k·nerd-font
lypzcgf14 天前
Coze源码分析-资源库-编辑插件-后端源码-IDL/API/应用服务层
系统架构·插件·coze·coze源码分析·智能体平台·ai应用平台·agent平台