From 78b47c98844b1f2dcad91f68df90738cbb688721 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Fri, 8 May 2020 23:23:52 +0100 Subject: [PATCH] Offer automatic install of Zinit if not already installed --- zshrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zshrc b/zshrc index 15c2ff5..ca7464f 100644 --- a/zshrc +++ b/zshrc @@ -15,9 +15,15 @@ fi # ============================================================================== declare -A ZINIT -ZINIT[BIN_DIR]="$DOTZSH/zinit" ZINIT[HOME_DIR]="$HOME/.local/zsh/zinit" +ZINIT[BIN_DIR]="${ZINIT[HOME_DIR]}/bin" +# Ask to clone Zinit if it's not already available on disk. +[ ! -d "${ZINIT[BIN_DIR]}" ] && \ + read -q "REPLY?Zinit not installed, clone to ${ZINIT[BIN_DIR]}? [y/N]:" && \ + echo && git clone "https://github.com/zdharma/zinit.git" "${ZINIT[BIN_DIR]}" + +# Load Zinit source "${ZINIT[BIN_DIR]}/zinit.zsh" # Enable using oh-my-zsh compatible themes.