summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimmy Keller <tjk@tjkeller.xyz>2024-09-08 20:51:04 -0500
committerTimmy Keller <tjk@tjkeller.xyz>2024-09-08 20:51:04 -0500
commit94ff8bfc0dc08abd08ee6826cb2b8e8a89071d68 (patch)
tree029e94cc99296f34ddc17b79539e7d429bb9e69d
parent99e8fcd1562b6a3c87ba5edafa8655bac4de9b96 (diff)
downloaddotconfig-94ff8bfc0dc08abd08ee6826cb2b8e8a89071d68.tar.xz
dotconfig-94ff8bfc0dc08abd08ee6826cb2b8e8a89071d68.zip
zplug no root is default and install if the directory doesnt exist
-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..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
}