安装 zsh

# 查看系统所有 shell
chsh -l

# 如果没有 zsh 则安装

## Ubuntu
sudo apt install zsh

## Centos
sudo yum install zsh

## Mac
brew install zsh

# 设置默认 shell 为 zsh
chsh -s /bin/zsh

# 如果提示没有 chsh 命令,编辑 .bash_profile,在末尾添加
export SHELL=/bin/zsh
exec /bin/zsh -l

# 新开一个终端确认是否完成切换
echo $SHELL

安装 oh-my-zsh

# 官网:<https://ohmyz.sh>
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

安装插件

Linux

cd ~/.oh-my-zsh/custom/plugins

# https://github.com/zsh-users/zsh-syntax-highlighting.git
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git

# https://github.com/zsh-users/zsh-autosuggestions.git
git clone https://github.com/zsh-users/zsh-autosuggestions.git

# autojump

## Ubuntu
sudo apt install autojump -y

## Centos
yum install autojump-zsh -y

vi ~/.zshrc

# 启用插件
plugins=(git zsh-autosuggestions zsh-syntax-highlighting autojump)

# 取消注释
HIST_STAMPS="mm/dd/yyyy"

# 停止检查更新,加到 `source $ZSH/oh-my-zsh.sh` 行之前
DISABLE_AUTO_UPDATE="true"

Mac

brew install autojump
brew install zsh-syntax-highlighting
brew install zsh-autosuggestions

自动更新插件

# <https://github.com/Pilaton/OhMyZsh-full-autoupdate>
cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/Pilaton/OhMyZsh-full-autoupdate.git

vi ~/.zshrc
plugins=(... ohmyzsh-full-autoupdate)
转载文章请注明出处。