一. 安装zsh
# 安装基础zsh
sudo apt-get install zsh
# 安装扩展oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
二. 安装插件
1. 下载插件到指定目录
# 进入插件目录
cd ~/.oh-my-zsh/custom/plugins
# 安装 zsh-autosuggestions(一个命令提示高亮插件)
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# 安装 zsh-syntax-highlighting(一个命令检查高亮插件)
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
2. 修改配置并生效
# 打开配置文件
vim ~/.zshrc
# 修改插件配置
plugins=(
# other plugins...
git
zsh-autosuggestions
zsh-syntax-highlighting
)
# 生效配置
source ~/.zshrc
三. 安装主题
1. 下载主题到指定目录
# 进入主题目录
cd ~/.oh-my-zsh/custom/themes
# 下载主题
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
2. 修改配置并生效
# 打开配置文件
vim ~/.zshrc
# 修改配置
ZSH_THEME="powerlevel10k/powerlevel10k"
# 生效配置
source ~/.zshrc
对于 powerlevel10k 来说, 可以使用下面命令重置主题配置
p10k configure