From b87b7c6cd12b95d69d5bdabd3180c39e6ea27950 Mon Sep 17 00:00:00 2001 From: Jo Wroten Date: Sun, 4 Aug 2019 15:46:43 -0500 Subject: [PATCH] Improved zsh installation steps --- zsh/install.sh | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/zsh/install.sh b/zsh/install.sh index efdc445..b8fc793 100644 --- a/zsh/install.sh +++ b/zsh/install.sh @@ -1,17 +1,39 @@ #!/bin/bash -echo " - Installing Zsh - " -sudo apt-get install zsh +echo "🤔 Checking for Zsh installation" +if zsh --version; then + echo "🥰 Zsh is already installed" +else + echo "🤩 Installing Zsh" + sudo apt-get install zsh + echo "👍 Zsh Installed" +fi -echo " - Setting Zsh as default - " +echo "🦄 Setting Zsh as default shell" sudo chsh -s /usr/bin/zsh +echo "👍 Zsh set as default shell, will take effect next time you log in (or type zsh into your terminal)" -echo " - Installing oh-my-zsh - " -sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +echo "🤔 Checking for oh-my-zsh installation" +if [ -d ~/.oh-my-zsh ]; then + echo "🥰 oh-my-zsh is already installed" +else + echo "🤩 Installing oh-my-zsh" + sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" + echo "👍 oh-my-zsh Installed" +fi -echo " - Setting oh-my-zsh theme -" +echo "🤔 Checking for zsh-autosuggestions installation" +if [ -d ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions ]; then + echo "🥰 zsh-autosuggestions is already installed" +else + echo "🤩 Installing zsh-autosuggestions" + git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions + sed -ri 's/plugins=\((.*?)\)/plugins=\(git zsh-autosuggestions\)/g' ~/.zshrc + echo "👍 zsh-autosuggestions Installed" +fi + +echo "🦄 Setting oh-my-zsh theme" sed -ri 's/ZSH_THEME="(.*?)"/ZSH_THEME="kardan"/g' ~/.zshrc -source ~/.zshrc +echo "👍 Set oh-my-zsh theme" -echo " - Setting up Zsh Plugins - " -git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions -sed -ri 's/plugins=\((.*?)\)/plugins=\(git zsh-autosuggestions\)/g' ~/.zshrc +source ~/.zshrc +echo "👍 Sourced updated zshrc"