1. 安装zsh
sudo apt install zsh
chsh -s /bin/zsh
2. 安装oh my zsh
先下载安装文件
wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh -P /opt/install_ohmyzsh/
赋予运行权限
chmod +x /opt/install_ohmyzsh/install.sh
更换为国内源
vim /opt/install_ohmyzsh/install.sh
把 REPO 和 REMOTE 这2行改为:
REPO=${REPO:-mirrors/oh-my-zsh} REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}
退出vim后,在安装时指定目录
ZSH=/opt/.oh-my-zsh sh /opt/install_ohmyzsh/install.sh
下载插件
git clone https://gitee.com/Annihilater/zsh-syntax-highlighting.git /opt/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting git clone https://gitee.com/chenweizhen/zsh-autosuggestions.git /opt/.oh-my-zsh/custom/plugins/zsh-autosuggestions
编辑配置文件
vim ~/.zshrc
更为
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
这里可以自己选择主题
懒得折腾的话,就从官方已有的进行选择
Themes · ohmyzsh/ohmyzsh Wiki · GitHub A delightful community-driven (with 2,100+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community. - Themes · ohmyzsh/ohmyzsh Wikihttps://github.com/ohmyzsh/ohmyzsh/wiki/Themes根据个人习惯,我这里使用了随机主题,有喜欢的可以改成相应的名字固定下来
ZSH_THEME="random"
可以查看当前的主题
echo $ZSH_THEME
配置命令行颜色之类的
export TERM=xterm-256color
刷新配置文件
source ~/.zshrc
其余用户使用zsh的话,可以直接复制该用户下的.zshrc文件,修改默认shell为zsh
chsh -s /bin/zsh
vim .zshrc
在source前,加上
ZSH_DISABLE_COMPFIX="true"