summaryrefslogtreecommitdiff
path: root/zsh/zscripts/zplug.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/zscripts/zplug.zsh')
-rwxr-xr-xzsh/zscripts/zplug.zsh11
1 files changed, 8 insertions, 3 deletions
diff --git a/zsh/zscripts/zplug.zsh b/zsh/zscripts/zplug.zsh
index b3eff09..27dc70f 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" ] && [ -f "$zplugs" ]; 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
}