Skip to content

Commit 7206f77

Browse files
committed
Change ZUNPLUG vars
1 parent 1bff4c3 commit 7206f77

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

zsh_unplugged.zsh

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,16 @@
22
# Usage: https://github.com/mattmc3/zsh_unplugged
33

44
# Set zsh_unplugged variables.
5-
if [[ -n "$ZPLUGINDIR" ]]; then
6-
: ${ZUNPLUG_CUSTOM:=$ZPLUGINDIR}
7-
: ${ZUNPLUG_REPOS:=$ZPLUGINDIR}
8-
else
9-
: ${ZUNPLUG_CUSTOM:=${ZDOTDIR:-$HOME/.config/zsh}/plugins}
10-
: ${ZUNPLUG_REPOS:=${XDG_DATA_HOME:-$HOME/.local/share}/zsh_unplugged}
11-
fi
5+
: ${ZUNPLUG_HOME:=${ZPLUGINDIR:-${XDG_DATA_HOME:-~/.local/share}/zsh_unplugged}}
6+
: ${ZUNPLUG_CUSTOM:=${ZSH_CUSTOM:-${ZDOTDIR:-~/.config/zsh}}/plugins}
127
typeset -gHa _zunplugopts=(extended_glob glob_dots no_monitor)
138

149
##? Clone zsh plugins in parallel.
1510
function plugin-clone {
1611
emulate -L zsh; setopt local_options $_zunplugopts
1712
local repo repodir
1813
for repo in ${(u)@}; do
19-
repodir=$ZUNPLUG_REPOS/${repo:t}
14+
repodir=$ZUNPLUG_HOME/${repo:t}
2015
[[ ! -d $repodir ]] || continue
2116
echo "Cloning $repo..."
2217
(
@@ -42,16 +37,16 @@ function plugin-script {
4237
# Remove bare words and paths, then split/join to keep the 2-part user/repo form.
4338
for repo in ${${(M)@:#*/*}:#/*}; do
4439
repo=${(@j:/:)${(@s:/:)repo}[1,2]}
45-
[[ -e $ZUNPLUG_REPOS/$repo ]] || repos+=$repo
40+
[[ -e $ZUNPLUG_HOME/$repo ]] || repos+=$repo
4641
done
4742
plugin-clone $repos >&2
4843

4944
for plugin in $@; do
5045
[[ $plugin == /* ]] || plugin=${plugin#*/}
5146
initpaths=(
52-
{$ZUNPLUG_CUSTOM,$ZUNPLUG_REPOS}/${plugin}/${plugin:t}.{plugin.zsh,zsh-theme,zsh,sh}(N)
53-
{$ZUNPLUG_CUSTOM,$ZUNPLUG_REPOS}/${plugin}/*.{plugin.zsh,zsh-theme,zsh,sh}(N)
54-
$ZUNPLUG_REPOS/$plugin(N)
47+
{$ZUNPLUG_CUSTOM,$ZUNPLUG_HOME}/${plugin}/${plugin:t}.{plugin.zsh,zsh-theme,zsh,sh}(N)
48+
{$ZUNPLUG_CUSTOM,$ZUNPLUG_HOME}/${plugin}/*.{plugin.zsh,zsh-theme,zsh,sh}(N)
49+
$ZUNPLUG_HOME/$plugin(N)
5550
${plugin}/*.{plugin.zsh,zsh-theme,zsh,sh}(N)
5651
${plugin}(N)
5752
)
@@ -67,7 +62,7 @@ function plugin-script {
6762
function plugin-update {
6863
emulate -L zsh; setopt local_options $_zunplugopts
6964
local repodir oldsha newsha
70-
for repodir in $ZUNPLUG_REPOS/**/.git(N/); do
65+
for repodir in $ZUNPLUG_HOME/**/.git(N/); do
7166
repodir=${repodir:A:h}
7267
echo "Updating ${repodir:t}..."
7368
(
@@ -87,7 +82,7 @@ function plugin-compile {
8782
emulate -L zsh; setopt local_options $_zunplugopts
8883
autoload -Uz zrecompile
8984
local zfile
90-
for zfile in ${1:-ZUNPLUG_REPOS}/**/*.zsh{,-theme}(N); do
85+
for zfile in ${1:-ZUNPLUG_HOME}/**/*.zsh{,-theme}(N); do
9186
[[ $zfile != */test-data/* ]] || continue
9287
zrecompile -pq "$zfile"
9388
done

0 commit comments

Comments
 (0)