fix bug in install_plugins function

This commit is contained in:
2026-01-22 11:56:18 +08:00
parent 12338c877a
commit d037c9e2eb

View File

@@ -15,14 +15,14 @@ function install_plugins() {
# git clone https://github.com/zsh-users/zsh-autosuggestions.git "$ZSH_PLUGINS_PATH"/zsh-autosuggestions # git clone https://github.com/zsh-users/zsh-autosuggestions.git "$ZSH_PLUGINS_PATH"/zsh-autosuggestions
git clone https://gitee.com/mirrors/zsh-autosuggestions.git "$ZSH_PLUGINS_PATH"/zsh-autosuggestions git clone https://gitee.com/mirrors/zsh-autosuggestions.git "$ZSH_PLUGINS_PATH"/zsh-autosuggestions
else else
cd "$ZSH_PLUGINS_PATH"/zsh-autosuggestions || return cd "$ZSH_PLUGINS_PATH"/zsh-autosuggestions
if [ ! -d .git ]; then if [ ! -d .git ]; then
echo "Zsh Autosuggestions is not a git repository. Please remove $ZSH_PLUGINS_PATH/zsh-autosuggestions and try again." echo "Zsh Autosuggestions is not a git repository. Please remove $ZSH_PLUGINS_PATH/zsh-autosuggestions and try again."
return
else else
echo "Zsh Autosuggestions is already exist. Updating..." echo "Zsh Autosuggestions is already exist. Updating..."
git pull git pull
fi fi
cd -
fi fi
# git clone zsh-syntax-highlighting # git clone zsh-syntax-highlighting
@@ -31,14 +31,14 @@ function install_plugins() {
# git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_PLUGINS_PATH"/zsh-syntax-highlighting # git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_PLUGINS_PATH"/zsh-syntax-highlighting
git clone https://gitee.com/mirrors/zsh-syntax-highlighting.git "$ZSH_PLUGINS_PATH"/zsh-syntax-highlighting git clone https://gitee.com/mirrors/zsh-syntax-highlighting.git "$ZSH_PLUGINS_PATH"/zsh-syntax-highlighting
else else
cd "$ZSH_PLUGINS_PATH"/zsh-syntax-highlighting || return cd "$ZSH_PLUGINS_PATH"/zsh-syntax-highlighting
if [ ! -d .git ]; then if [ ! -d .git ]; then
echo "Zsh Syntax Highlighting is not a git repository. Please remove $ZSH_PLUGINS_PATH/zsh-syntax-highlighting and try again." echo "Zsh Syntax Highlighting is not a git repository. Please remove $ZSH_PLUGINS_PATH/zsh-syntax-highlighting and try again."
return
else else
echo "Zsh Syntax Highlighting is already exist. Updating..." echo "Zsh Syntax Highlighting is already exist. Updating..."
git pull git pull
fi fi
cd -
fi fi
# git clone zsh-autocomplete # git clone zsh-autocomplete
@@ -46,16 +46,15 @@ function install_plugins() {
echo "Zsh Autocomplete is not downloaded. Downloading..." echo "Zsh Autocomplete is not downloaded. Downloading..."
# git clone https://github.com/marlonrichert/zsh-autocomplete.git "$ZSH_PLUGINS_PATH"/zsh-autocomplete # git clone https://github.com/marlonrichert/zsh-autocomplete.git "$ZSH_PLUGINS_PATH"/zsh-autocomplete
git clone https://gitee.com/mirrors/zsh-autocomplete.git "$ZSH_PLUGINS_PATH"/zsh-autocomplete git clone https://gitee.com/mirrors/zsh-autocomplete.git "$ZSH_PLUGINS_PATH"/zsh-autocomplete
else else
cd "$ZSH_PLUGINS_PATH"/zsh-autocomplete || return cd "$ZSH_PLUGINS_PATH"/zsh-autocomplete
if [ ! -d .git ]; then if [ ! -d .git ]; then
echo "Zsh Autocomplete is not a git repository. Please remove $ZSH_PLUGINS_PATH/zsh-autocomplete and try again." echo "Zsh Autocomplete is not a git repository. Please remove $ZSH_PLUGINS_PATH/zsh-autocomplete and try again."
return
else else
echo "Zsh Autocomplete is already exist. Updating..." echo "Zsh Autocomplete is already exist. Updating..."
git pull git pull
fi fi
cd -
fi fi
# git clone fzf-tab # git clone fzf-tab
@@ -63,14 +62,14 @@ function install_plugins() {
echo "fzf-tab is not downloaded. Downloading..." echo "fzf-tab is not downloaded. Downloading..."
git clone https://github.com/Aloxaf/fzf-tab.git "$ZSH_PLUGINS_PATH"/fzf-tab git clone https://github.com/Aloxaf/fzf-tab.git "$ZSH_PLUGINS_PATH"/fzf-tab
else else
cd "$ZSH_PLUGINS_PATH"/fzf-tab || return cd "$ZSH_PLUGINS_PATH"/fzf-tab
if [ ! -d .git ]; then if [ ! -d .git ]; then
echo "fzf-tab is not a git repository. Please remove $ZSH_PLUGINS_PATH/fzf-tab and try again." echo "fzf-tab is not a git repository. Please remove $ZSH_PLUGINS_PATH/fzf-tab and try again."
return
else else
echo "fzf-tab is already exist. Updating..." echo "fzf-tab is already exist. Updating..."
git pull git pull
fi fi
cd -
fi fi
# git clone oh-my-zsh # git clone oh-my-zsh
@@ -79,15 +78,15 @@ function install_plugins() {
# git clone https://github.com/ohmyzsh/ohmyzsh.git "$PATH_OHMYZSH" # git clone https://github.com/ohmyzsh/ohmyzsh.git "$PATH_OHMYZSH"
git clone https://gitee.com/mirrors/ohmyzsh.git "$ZSH_PLUGINS_PATH"/ohmyzsh git clone https://gitee.com/mirrors/ohmyzsh.git "$ZSH_PLUGINS_PATH"/ohmyzsh
else else
cd "$ZSH_PLUGINS_PATH"/ohmyzsh || return cd "$ZSH_PLUGINS_PATH"/ohmyzsh
if [ ! -d .git ]; then if [ ! -d .git ]; then
echo "Oh My Zsh is not a git repository. Please remove $ZSH_PLUGINS_PATH/ohmyzsh and try again." echo "Oh My Zsh is not a git repository. Please remove $ZSH_PLUGINS_PATH/ohmyzsh and try again."
return
else else
echo "Oh My Zsh is already exist. Updating..." echo "Oh My Zsh is already exist. Updating..."
git pull git pull
fi fi
cd -
fi fi
echo "All plugins are installed/updated. Run 'exec zsh' to apply changes." echo "All plugins are installed/updated. Run 'exec zsh' to apply changes."
} }