CentOS 安装 zsh

19 min read

oh-my-zsh 安装方法

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 

安装zsh-autosuggestionsr 插件

plugins=( 
    git
    zsh-autosuggestions
)

source ~/.zshrc

// Clone this repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins)
// Add the plugin to the list of plugins for Oh My Zsh to load (inside ~/.zshrc):

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

oh-my-zsh显示主机名

vim ~/.zshrc
ZSH_THEME="lukerandall"
source ~/.zshrc

// 其它theme https://travis.media/top-12-oh-my-zsh-themes-for-productive-developers/

以下为zsh国内安装方法

获取安装脚本

wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh

编辑install.sh ,修改源,找到以下部分

# Default settings
ZSH=${ZSH:-~/.oh-my-zsh}
REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master}

REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}

替换为

REPO=${REPO:-mirrors/oh-my-zsh}
REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}

编辑后保存, 运行安装即可. (运行前先给install.sh权限)

修改仓库地址

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