使用下面的脚本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

# install Zsh
echo "Updating package list and installing Zsh..."
if command_exists apt; then
sudo apt install -y zsh git curl wget
elif command_exists dnf; then
sudo dnf install -y zsh git curl wget
elif command_exists brew; then
brew install zsh git curl wget
else
echo "Unsupported package manager. Please install Zsh, Git, Curl, and Wget manually."
exit 1
fi

echo "installing Oh My Zsh..."
bash -c "$(curl -fsSL https://gitee.com/focnal/ohmyzsh/raw/master/tools/install.sh)"

echo "installing plugins..."

# install zsh-syntax-highlighting
git clone https://gitee.com/focnal/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
sed -i.bak '/^plugins=/ s/)/ zsh-syntax-highlighting)/' ~/.zshrc

# install zsh-completions
git clone https://gitee.com/focnal/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions
sed -i.bak '/^plugins=/ s/)/ zsh-completions)/' ~/.zshrc

# install zsh-autosuggestions
git clone https://gitee.com/focnal/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
sed -i.bak '/^plugins=/ s/)/ zsh-autosuggestions)/' ~/.zshrc
source ~/.zshrc