1. 预先条件:
ping www.baidu.com
sudo apt install zsh unzip wget -y
2. 设置shell为zsh(已经为zsh的话可跳过)
cat /etc/shells
chsh -s /bin/zsh
reboot
echo $SHELL
vim ~/.bashrc
if [ -t 1 ]; then
exec zsh
fi
3. 执行下面安装oh-my-zsh的脚本(记得先备份一下自己的~/.zshrc文件)
#!/bin/zsh
wget https://github.com/ohmyzsh/ohmyzsh/archive/refs/heads/master.zip -O ohmyzsh.zip
wget https://github.com/zsh-users/zsh-autosuggestions/archive/refs/heads/master.zip -O zsh-autosuggestions.zip
wget https://github.com/zsh-users/zsh-syntax-highlighting/archive/refs/heads/master.zip -O zsh-syntax-highlighting.zip
unzip ohmyzsh.zip
unzip zsh-autosuggestions.zip
unzip zsh-syntax-highlighting.zip
cp -r ohmyzsh-master ~/.oh-my-zsh
cp -r zsh-autosuggestions-master ~/.oh-my-zsh/plugins/zsh-autosuggestions
cp -r zsh-syntax-highlighting-master ~/.oh-my-zsh/plugins/zsh-syntax-highlighting
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
sed -i 's/plugins=(.*)/plugins=(git sudo zsh-syntax-highlighting zsh-autosuggestions)/' ~/.zshrc
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="ys"/' ~/.zshrc
echo "安装完成!请运行: "
echo "source ~/.zshrc"