From 038cf2b2c768599abda2ee3145a111efb61543ff Mon Sep 17 00:00:00 2001 From: Frank Qing Date: Fri, 6 Sep 2024 16:44:07 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20(.zshrc,=20install.sh):=20add=20aut?= =?UTF-8?q?ojump=20support=20and=20installation=20across=20multiple=20OSes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .zshrc | 4 ++++ install.sh | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.zshrc b/.zshrc index 0815c23..70f2feb 100644 --- a/.zshrc +++ b/.zshrc @@ -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" diff --git a/install.sh b/install.sh index 0508956..6e6e531 100755 --- a/install.sh +++ b/install.sh @@ -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