一键安装命令:
apt update
apt install -y zsh git curl wget
# 找到仓库,然后clone到本地
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
# 复制.zshrc
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
# shell换成zsh
chsh -s /bin/zsh
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
sed -i 's/^ZSH_THEME=.*$/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc
sed -i 's/^plugins=.*$/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc
grep -q 'source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' ~/.zshrc || echo 'source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' >> ~/.zshrc
安装ohmyzsh
直接输入下面的命令即可
apt install zsh
#找到仓库, 然后clone到本地
git clone https://github.com/ohmyzsh/ohmyzsh.git
#把仓库复制到 .oh-my-zsh目录
cp -r ohmyzsh ~/.oh-my-zsh
#复制.zshrc
cp ohmyzsh/templates/zshrc.zsh-template ~/.zshrc
#shell换成zsh
chsh -s /bin/zsh
#删除ohmyzsh
rm -rf ./ohmyzsh
安装相关文件(Powerlevel10k,zsh-syntax-highlighting,zsh-autosuggestions)
- 下载
powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
- 下载
zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
- 下载
zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
修改相关配置
修改~/.zshrc
vim ~/.zshrc
将主题修改为Powerlevel10k
编辑为 ZSH_THEME="powerlevel10k/powerlevel10k"
。
ZSH_THEME="powerlevel10k/powerlevel10k"
修改插件
找到 plugins
,我们需要把高亮插件和提示插件加上: plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
注意!!!这里的顺序不要改变
其他添加
在~/.zshrc
末尾添加
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
大功告成,只需要
source ~/.zshrc
Powerlevel10k配置
相关配置只要根据提示进行即可,此处略去