From 94ff8bfc0dc08abd08ee6826cb2b8e8a89071d68 Mon Sep 17 00:00:00 2001 From: Timmy Keller Date: Sun, 8 Sep 2024 20:51:04 -0500 Subject: zplug no root is default and install if the directory doesnt exist --- zsh/zscripts/zplug.zsh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zsh/zscripts/zplug.zsh b/zsh/zscripts/zplug.zsh index b3eff09..690e9f4 100755 --- a/zsh/zscripts/zplug.zsh +++ b/zsh/zscripts/zplug.zsh @@ -1,8 +1,9 @@ #!/usr/bin/env zsh -local zplugs="${ZDOTDIR:-~/.}${ZDOTDIR:+/}zplugs" # Declare all variables using `local` to keep them away from the interactive shell -local zplugins="${ZPLUGINSDIR:-/usr/local/share/zsh/zplugins}" # TODO set default dir if zplugnoroot -[[ $EUID != 0 ]] && [ -z "$ZPLUGNOROOT" ] && local sudo=${SUDO-sudo} +local home=~ +local zplugs="${ZDOTDIR:-$home/.}${ZDOTDIR:+/}zplugs" # Declare all variables using `local` to keep them away from the interactive shell +local zplugins="${ZPLUGINSDIR:-$home/.local/share/zsh/zplugins}" +#[[ $EUID != 0 ]] && [ -z "$ZPLUGNOROOT" ] && local sudo=${SUDO-sudo} function __zplugInstall() { touch "$zplugs" @@ -127,5 +128,9 @@ function zplug() { function zplugInitialize() { local plugin + if ! [ -d "$zplugins" ]; then + echo "zplug installing plugins..." + __zplugInstall 0 # Put in some value since there is a shift + fi for plugin in "$zplugins"/*/*.zsh; do source "$plugin"; done 2>/dev/null } -- cgit v1.2.3