ZSH配置
1. 安装
准备工作
安装zsh
1 2 3 4
| apt install -y zsh
yum install -y zsh
|
设置zsh为默认shell
安装git, wget
1 2 3 4
| apt install -y git wget
yum install -y git wget
|
安装 oh-my-zsh
使用wget获取安装脚本
1
| wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh
|
找到以下部分
1 2 3 4 5
| ZSH=${ZSH:-~/.oh-my-zsh} REPO=${REPO:-ohmyzsh/ohmyzsh} REMOTE=${REMOTE:-https://github.com/${REPO}.git} BRANCH=${BRANCH:-master}
|
把中间两行修改为:
1 2
| REPO=${REPO:-mirrors/oh-my-zsh} REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}
|
:wq!
保存 sh install.sh
执行
2. 配置
基础配置
编辑 ~/.zshrc
1 2 3 4 5 6
| export PATH=$HOME/bin:/usr/local/bin:$PATH
DISABLE_AUTO_UPDATE="true"
ZSH_THEME="steeef"
|
安装插件
1
| git clone https://gitee.com/yantaozhao/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
|
将插件添加至配置文件~/.zshrc
中, 将 plugins=(git)
替换为
1 2 3 4
| plugins=( git zsh-autosuggestions )
|
之后执行 source ~/.zshrc
即可生效
如果字体不清晰,可以修改 ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
内的 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=240'
注: 颜色值参考
1
| git clone https://gitee.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
|
将插件添加至配置文件~/.zshrc
中
1 2 3 4 5
| plugins=( git zsh-syntax-highlighting zsh-autosuggestions )
|
git-bash 安装zsh
一文搞定 Windows Terminal 设置与 zsh 安装【非WSL】
Windows在git-bash安装zsh - 掘金