1. on-my-zsh安裝
1.1. 使用curl方式安裝
1.1.1 官方映象源
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
1.1.2 國內Gitee加速源
sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"
1.2. 使用wget方式安裝
1.2.1 官方映象源
sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
1.2.2 國內Gitee加速源
sh -c "$(wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh -O -)"
2. Oh-my-zsh配置
2.1 主題配置
- Oh-my-zsh路徑為 ~/.oh-my-zsh/themes目錄內,我比較喜歡robbyrussell
# 可在主題目錄內查詢自己喜歡的主題
ls ~/.oh-my-zsh/themes/
- 修改~/.zshrc檔案,將主題修改為robbyrussell
➜ ~ cat ~/.zshrc | grep ZSH_THEME
ZSH_THEME="robbyrussell"
# Setting this variable when ZSH_THEME=random will cause zsh to load
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
➜ ~
- 如果你喜歡挑戰,想嘗試使用不同主題,可以考慮將主題設定成隨機模式
ZSH_THEME="random"
2.2 外掛配置
2.1 下載外掛
2.1.1 自動補全外掛
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
2.1.2 語法高亮外掛
git clone https://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
2.2 引入外掛
- 引入外掛需要編輯~/.zshrc檔案,在配置檔案中找到plugins檔案行,在其中新增內容,如下是修改完成後的配置
➜ ~ cat ~/.zshrc | grep plugins=
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git autojump zsh-autosuggestions zsh-syntax-highlighting)
➜ ~