使用 Gitee 国内源 安装 Oh My Zsh

Oh My Zsh是一个令人愉快的、开源的、社区驱动的框架,用于管理Zsh配置。它捆绑了成千上万的有用的功能,助手,插件,主题等,好用到让你尖叫…

安装

# 安装ZSH和Git
apt install zsh git autojump curl

# 下载安装文件
curl -O https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh

# 给安装脚本执行权限
chmod +x install.sh

# 替换版本库地址
sed -i 's/REPO:-ohmyzsh\/ohmyzsh/REPO:-mirrors\/oh-my-zsh/' ./install.sh
sed -i 's/REMOTE:-https:\/\/github.com/REMOTE:-https:\/\/gitee.com/' ./install.sh

# 安装
./install.sh

修改仓库地址并更新

cd ~/.oh-my-zsh
git remote set-url origin https://gitee.com/mirrors/oh-my-zsh.git
git pull

下载第三方插件

git clone https://gitee.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://gitee.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

启用 oh-my-zsh 插件

sed -i 's/plugins=(git)/plugins=(git autojump systemd wd common-aliases command-not-found zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc

设置环境变量

sed -i "/export PATH/a\export PATH=$PATH" ~/.zshrc

加载 .zshrc 使最新配置生效

source ~/.zshrc
上一篇
下一篇