(.zshrc, install.sh): add autojump support and installation across multiple OSes

This commit is contained in:
Frank Qing
2024-09-06 16:44:07 +08:00
parent e74202be06
commit 038cf2b2c7
2 changed files with 13 additions and 9 deletions

4
.zshrc
View File

@@ -224,6 +224,10 @@ source $ZSH/oh-my-zsh.sh
# Configs that can only work after "source $ZSH/oh-my-zsh.sh", such as Aliases that depend oh-my-zsh plugins
# Autojump configuration
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
[ -f /usr/share/autojump/autojump.sh ] && . /usr/share/autojump/autojump.sh
# Now source fzf.zsh , otherwise Ctr+r is overwritten by ohmyzsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_OPS="--extended"

View File

@@ -48,35 +48,35 @@ install_packages() {
echo "Homebrew is not installed. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew install zsh git wget fontconfig
brew install zsh git wget fontconfig autojump
;;
ubuntu|debian)
sudo apt-get update
sudo apt-get install -y zsh git wget fontconfig
sudo apt-get install -y zsh git wget fontconfig autojump
;;
fedora)
sudo dnf install -y zsh git wget fontconfig
sudo dnf install -y zsh git wget fontconfig autojump
;;
centos|rhel)
sudo yum install -y zsh git wget fontconfig
sudo yum install -y zsh git wget fontconfig autojump
;;
arch|manjaro)
sudo pacman -Syu --noconfirm zsh git wget fontconfig
sudo pacman -Syu --noconfirm zsh git wget fontconfig autojump
;;
*)
echo "Unsupported operating system. Please install zsh, git, wget, and fontconfig manually."
echo "Unsupported operating system. Please install zsh, git, wget, fontconfig, and autojump manually."
exit 1
;;
esac
}
# Check if required packages are installed, if not, install them
if command -v zsh &> /dev/null && command -v git &> /dev/null && command -v wget &> /dev/null && command -v fc-cache &> /dev/null; then
echo -e "ZSH, Git, wget, and fontconfig are already installed\n"
if command -v zsh &> /dev/null && command -v git &> /dev/null && command -v wget &> /dev/null && command -v fc-cache &> /dev/null && command -v autojump &> /dev/null; then
echo -e "ZSH, Git, wget, fontconfig, and autojump are already installed\n"
else
echo "Installing required packages..."
install_packages
echo -e "zsh, wget, git, and fontconfig Installed\n"
echo -e "zsh, wget, git, fontconfig, and autojump Installed\n"
fi
if [ -f ~/.gitconfig.backup ]; then