mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 07:36:38 -04:00
Merge /home/sg/zinit
This commit is contained in:
commit
2b21ff2a38
|
|
@ -3211,28 +3211,22 @@ EOF
|
|||
# ]]]
|
||||
# FUNCTION: .zinit-recall [[[
|
||||
.zinit-recall() {
|
||||
emulate -LR zsh
|
||||
setopt extendedglob warncreateglobal typesetsilent noshortloops
|
||||
|
||||
local -A ice
|
||||
local el val cand1 cand2 local_dir filename is_snippet
|
||||
|
||||
local -a ice_order nval_ices output
|
||||
ice_order=(
|
||||
svn proto from teleid bindmap cloneopts id-as depth if wait load
|
||||
unload blockf pick bpick src as ver silent lucid notify mv cp
|
||||
atinit atclone atload atpull nocd run-atpull has cloneonly make
|
||||
service trackbinds multisrc compile nocompile nocompletions
|
||||
reset-prompt wrap-track reset sh \!sh bash \!bash ksh \!ksh csh
|
||||
\!csh aliases countdown ps-on-unload ps-on-update trigger-load
|
||||
light-mode is-snippet atdelete pack git verbose on-update-of
|
||||
subscribe param extract
|
||||
${(s.|.)ZINIT[ice-list]}
|
||||
|
||||
# Include all additional ices – after
|
||||
# stripping them from the possible: ''
|
||||
${(@us.|.)${ZINIT_EXTS[ice-mods]//\'\'/}}
|
||||
)
|
||||
nval_ices=(
|
||||
blockf silent lucid trackbinds cloneonly nocd run-atpull
|
||||
nocompletions sh \!sh bash \!bash ksh \!ksh csh \!csh
|
||||
aliases countdown light-mode is-snippet git verbose
|
||||
|
||||
${(s.|.)ZINIT[nval-ice-list]}
|
||||
# Include only those additional ices,
|
||||
# don't have the '' in their name, i.e.
|
||||
# aren't designed to hold value
|
||||
|
|
@ -3244,19 +3238,19 @@ EOF
|
|||
.zinit-compute-ice "$1${${1:#(%|/)*}:+${2:+/}}$2" "pack" \
|
||||
ice local_dir filename is_snippet || return 1
|
||||
|
||||
[[ -e "$local_dir" ]] && {
|
||||
for el in "${ice_order[@]}"; do
|
||||
[[ -e $local_dir ]] && {
|
||||
for el ( ${ice_order[@]} ) {
|
||||
val="${ice[$el]}"
|
||||
cand1="${(qqq)val}"
|
||||
cand2="${(qq)val}"
|
||||
if [[ -n "$val" ]]; then
|
||||
if [[ -n "$val" ]] {
|
||||
[[ "${cand1/\\\$/}" != "$cand1" || "${cand1/\\\!/}" != "$cand1" ]] && output+=( "$el$cand2" ) || output+=( "$el$cand1" )
|
||||
elif [[ ${+ice[$el]} = 1 && ( -n "${nval_ices[(r)$el]}" || "$el" = (make|nocompile|notify|reset) ) ]]; then
|
||||
} elif [[ ${+ice[$el]} = 1 && ( -n "${nval_ices[(r)$el]}" || "$el" = (make|nocompile|notify|reset) ) ]] {
|
||||
output+=( "$el" )
|
||||
fi
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
if [[ "${#output}" = 0 ]]; then
|
||||
if [[ ${#output} = 0 ]]; then
|
||||
print -zr "# No Ice modifiers"
|
||||
else
|
||||
print -zr "zinit ice ${output[*]}; zinit "
|
||||
|
|
@ -3303,29 +3297,30 @@ EOF
|
|||
setopt localoptions localtraps
|
||||
trap 'return 1' INT TERM
|
||||
( builtin cd -q "${ZINIT[BIN_DIR]}"/zmodules
|
||||
print -r -- "${ZINIT[col-pname]}== Building module zdharma/zplugin, running: make clean, then ./configure and then make ==${ZINIT[col-rst]}"
|
||||
print -r -- "${ZINIT[col-pname]}== The module sources are located at: "${ZINIT[BIN_DIR]}"/zmodules ==${ZINIT[col-rst]}"
|
||||
+zinit-message "[pname]== Building module zdharma/zplugin, running: make clean, then ./configure and then make ==[rst]"
|
||||
+zinit-message "[pname]== The module sources are located at: "${ZINIT[BIN_DIR]}"/zmodules ==[rst]"
|
||||
[[ -f Makefile ]] && { [[ "$1" = "--clean" ]] && {
|
||||
print -r -- ${ZINIT[col-p]}-- make distclean --${ZINIT[col-rst]}
|
||||
noglob +zinit-message [p]-- make distclean --[rst]
|
||||
make distclean
|
||||
((1))
|
||||
} || {
|
||||
print -r -- ${ZINIT[col-p]}-- make clean --${ZINIT[col-rst]}
|
||||
noglob +zinit-message [p]-- make clean --[rst]
|
||||
make clean
|
||||
}
|
||||
}
|
||||
print -r -- ${ZINIT[col-p]}-- ./configure --${ZINIT[col-rst]}
|
||||
noglob +zinit-message [p]-- ./configure --[rst]
|
||||
CPPFLAGS=-I/usr/local/include CFLAGS="-g -Wall -O3" LDFLAGS=-L/usr/local/lib ./configure --disable-gdbm --without-tcsetpgrp && {
|
||||
print -r -- ${ZINIT[col-p]}-- make --${ZINIT[col-rst]}
|
||||
noglob +zinit-message [p]-- make --[rst]
|
||||
make && {
|
||||
[[ -f Src/zdharma/zplugin.so ]] && cp -vf Src/zdharma/zplugin.{so,bundle}
|
||||
print -r -- "${ZINIT[col-info]}Module has been built correctly.${ZINIT[col-rst]}"
|
||||
noglob +zinit-message "[info]Module has been built correctly.[rst]"
|
||||
.zinit-module info
|
||||
} || {
|
||||
print -rn -- "${ZINIT[col-error]}Module didn't build.${ZINIT[col-rst]} "
|
||||
noglob +zinit-message "[error]Module didn't build.[rst] "
|
||||
.zinit-module info --link
|
||||
}
|
||||
}
|
||||
print $EPOCHSECONDS >! "${ZINIT[BIN_DIR]}"/zmodules/COMPILED_AT
|
||||
)
|
||||
}
|
||||
# ]]]
|
||||
|
|
|
|||
|
|
@ -1364,6 +1364,11 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh"
|
|||
[[ ${#list2} -gt 0 ]] && list=( ${list2[@]} )
|
||||
}
|
||||
|
||||
[[ ${#list} -gt 1 ]] && {
|
||||
list2=( ${list[@]:#(#i)*.sha256} )
|
||||
[[ ${#list2} -gt 0 ]] && list=( ${list2[@]} )
|
||||
}
|
||||
|
||||
[[ $#list -eq 0 ]] && {
|
||||
print -nr "${ZINIT[col-msg2]}Didn't find correct Github" \
|
||||
"release-file to download"
|
||||
|
|
|
|||
|
|
@ -182,22 +182,14 @@
|
|||
# Copy from .zinit-recall
|
||||
local -a ice_order nval_ices
|
||||
ice_order=(
|
||||
svn proto from teleid bindmap cloneopts id-as depth if wait load
|
||||
unload blockf pick bpick src as ver silent lucid notify mv cp
|
||||
atinit atclone atload atpull nocd run-atpull has cloneonly make
|
||||
service trackbinds multisrc compile nocompile nocompletions
|
||||
reset-prompt wrap-track reset sh \!sh bash \!bash ksh \!ksh csh
|
||||
\!csh aliases countdown ps-on-unload ps-on-update trigger-load
|
||||
light-mode is-snippet atdelete pack git verbose on-update-of
|
||||
subscribe param extract
|
||||
${(s.|.)ZINIT[ice-list]}
|
||||
|
||||
# Include all additional ices – after
|
||||
# stripping them from the possible: ''
|
||||
${(@us.|.)${ZINIT_EXTS[ice-mods]//\'\'/}}
|
||||
)
|
||||
nval_ices=(
|
||||
blockf silent lucid trackbinds cloneonly nocd run-atpull
|
||||
nocompletions sh \!sh bash \!bash ksh \!ksh csh \!csh
|
||||
aliases countdown light-mode is-snippet git verbose
|
||||
${(s.|.)ZINIT[nval-ice-list]}
|
||||
|
||||
# Include only those additional ices,
|
||||
# don't have the '' in their name, i.e.
|
||||
|
|
@ -343,22 +335,13 @@
|
|||
# Copy from .zinit-recall
|
||||
local -a ice_order nval_ices
|
||||
ice_order=(
|
||||
svn proto from teleid bindmap cloneopts id-as depth if wait load
|
||||
unload blockf pick bpick src as ver silent lucid notify mv cp
|
||||
atinit atclone atload atpull nocd run-atpull has cloneonly make
|
||||
service trackbinds multisrc compile nocompile nocompletions
|
||||
reset-prompt wrap-track reset sh \!sh bash \!bash ksh \!ksh csh
|
||||
\!csh aliases countdown ps-on-unload ps-on-update trigger-load
|
||||
light-mode is-snippet atdelete pack git verbose on-update-of
|
||||
subscribe param extract
|
||||
${(s.|.)ZINIT[ice-list]}
|
||||
# Include all additional ices – after
|
||||
# stripping them from the possible: ''
|
||||
${(@s.|.)${ZINIT_EXTS[ice-mods]//\'\'/}}
|
||||
)
|
||||
nval_ices=(
|
||||
blockf silent lucid trackbinds cloneonly nocd run-atpull
|
||||
nocompletions sh \!sh bash \!bash ksh \!ksh csh \!csh
|
||||
aliases countdown light-mode is-snippet git verbose
|
||||
${(s.|.)ZINIT[nval-ice-list]}
|
||||
|
||||
# Include only those additional ices,
|
||||
# don't have the '' in their name, i.e.
|
||||
|
|
|
|||
726
zinit.zsh
726
zinit.zsh
|
|
@ -52,6 +52,18 @@ if [[ -z ${ZINIT[HOME_DIR]} ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
ZINIT[ice-list]="svn|proto|from|teleid|bindmap|cloneopts|id-as|depth|if|wait|load|\
|
||||
unload|blockf|pick|bpick|src|as|ver|silent|lucid|notify|mv|cp|\
|
||||
atinit|atclone|atload|atpull|nocd|run-atpull|has|cloneonly|make|\
|
||||
service|trackbinds|multisrc|compile|nocompile|nocompletions|\
|
||||
reset-prompt|wrap-track|reset|sh|\!sh|bash|\!bash|ksh|\!ksh|csh|\
|
||||
\!csh|aliases|countdown|ps-on-unload|ps-on-update|trigger-load|\
|
||||
light-mode|is-snippet|atdelete|pack|git|verbose|on-update-of|\
|
||||
subscribe|extract|param"
|
||||
ZINIT[nval-ice-list]="blockf|silent|lucid|trackbinds|cloneonly|nocd|run-atpull|\
|
||||
nocompletions|sh|\!sh|bash|\!bash|ksh|\!ksh|csh|\!csh|\
|
||||
aliases|countdown|light-mode|is-snippet|git|verbose"
|
||||
|
||||
# Can be customized
|
||||
: ${ZINIT[PLUGINS_DIR]:=${ZINIT[HOME_DIR]}/plugins}
|
||||
: ${ZINIT[COMPLETIONS_DIR]:=${ZINIT[HOME_DIR]}/completions}
|
||||
|
|
@ -256,8 +268,9 @@ builtin setopt noaliases
|
|||
#
|
||||
# The hijacking is to gather report data (which is used in unload).
|
||||
:zinit-shadow-bindkey() {
|
||||
builtin setopt localoptions noerrreturn noerrexit extendedglob warncreateglobal \
|
||||
typesetsilent noshortloops unset
|
||||
emulate -LR zsh
|
||||
builtin setopt extendedglob warncreateglobal typesetsilent noshortloops
|
||||
|
||||
is-at-least 5.3 && \
|
||||
.zinit-add-report "${ZINIT[CUR_USPL2]}" "Bindkey ${(j: :)${(q+)@}}" || \
|
||||
.zinit-add-report "${ZINIT[CUR_USPL2]}" "Bindkey ${(j: :)${(q)@}}"
|
||||
|
|
@ -809,6 +822,9 @@ function $f {
|
|||
} # ]]]
|
||||
# FUNCTION: @zinit-substitute [[[
|
||||
@zinit-substitute() {
|
||||
emulate -LR zsh
|
||||
setopt extendedglob warncreateglobal typesetsilent noshortloops
|
||||
|
||||
local -A __subst_map
|
||||
__subst_map=(
|
||||
"%ID%" "${id_as_clean:-$id_as}"
|
||||
|
|
@ -822,14 +838,16 @@ function $f {
|
|||
'%VENDOR%' "$VENDOR" '%HOST%' "$HOST" '%UID%' "$UID" '%GID%' "$GID"
|
||||
)
|
||||
if [[ -n ${ZINIT_ICE[param]} && ${ZINIT[SUBST_DONE_FOR]} != ${ZINIT_ICE[param]} ]] {
|
||||
ZINIT[SUBST_DONE_FOR]="${ZINIT_ICE[param]}"
|
||||
ZINIT[SUBST_DONE_FOR]=${ZINIT_ICE[param]}
|
||||
ZINIT[PARAM_SUBST]=
|
||||
local -a __params
|
||||
__params=( ${(s.;.)ZINIT_ICE[param]} )
|
||||
local __param __from __to
|
||||
for __param ( ${__params[@]} ) {
|
||||
local __from="${${__param%%([[:space:]]|)(->|→)*}##[[:space:]]##}" \
|
||||
__to="${${__param##*(->|→)([[:space:]]|)}%[[:space:]]}"
|
||||
local __from=${${__param%%([[:space:]]|)(->|→)*}##[[:space:]]##} \
|
||||
__to=${${__param#*(->|→)([[:space:]]|)}%[[:space:]]}
|
||||
__from=${__from//((#s)[[:space:]]##|[[:space:]]##(#e))/}
|
||||
__to=${__to//((#s)[[:space:]]##|[[:space:]]##(#e))/}
|
||||
ZINIT[PARAM_SUBST]+="%${(q)__from}% ${(q)__to} "
|
||||
}
|
||||
}
|
||||
|
|
@ -838,16 +856,12 @@ function $f {
|
|||
__add=( "${ZINIT_ICE[param]:+${(@Q)${(@z)ZINIT[PARAM_SUBST]}}}" )
|
||||
(( ${#__add} % 2 == 0 )) && __subst_map+=( "${__add[@]}" )
|
||||
|
||||
local __var_name MATCH
|
||||
integer MBEGIN MEND
|
||||
() {
|
||||
setopt localoptions extendedglob
|
||||
for __var_name; do
|
||||
local __value="${(P)__var_name}"
|
||||
__value="${__value//(#m)(%[a-zA-Z0-9]##%|\$ZPFX|\$\{ZPFX\})/${__subst_map[$MATCH]}}"
|
||||
: "${(P)__var_name::=$__value}"
|
||||
done
|
||||
} "$@"
|
||||
local __var_name
|
||||
for __var_name; do
|
||||
local __value=${(P)__var_name}
|
||||
__value=${__value//(#m)(%[a-zA-Z0-9]##%|\$ZPFX|\$\{ZPFX\})/${__subst_map[$MATCH]}}
|
||||
: ${(P)__var_name::=$__value}
|
||||
done
|
||||
}
|
||||
# ]]]
|
||||
# FUNCTION: .zinit-any-to-user-plugin [[[
|
||||
|
|
@ -1069,14 +1083,7 @@ function $f {
|
|||
local id_as="$1" __key __path
|
||||
local -a ice_order
|
||||
ice_order=(
|
||||
svn proto from teleid bindmap cloneopts id-as depth if wait load
|
||||
unload blockf pick bpick src as ver silent lucid notify mv cp
|
||||
atinit atclone atload atpull nocd run-atpull has cloneonly make
|
||||
service trackbinds multisrc compile nocompile nocompletions
|
||||
reset-prompt wrap-track reset sh \!sh bash \!bash ksh \!ksh csh
|
||||
\!csh aliases countdown ps-on-unload ps-on-update trigger-load
|
||||
light-mode is-snippet atdelete pack git verbose on-update-of
|
||||
subscribe extract
|
||||
${(As:|:)ZINIT[ice-list]}
|
||||
${(@us.|.)${ZINIT_EXTS[ice-mods]//\'\'/}}
|
||||
)
|
||||
__path="${ZINIT[PLUGINS_DIR]}/${id_as//\//---}"/._zinit
|
||||
|
|
@ -1177,6 +1184,280 @@ function $f {
|
|||
ZINIT[AT_TIME_${ZINIT[TIME_INDEX]}_${id_as//\//---}]=$EPOCHREALTIME
|
||||
return $retval
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-load-snippet [[[
|
||||
# Implements the exposed-to-user action of loading a snippet.
|
||||
#
|
||||
# $1 - url (can be local, absolute path)
|
||||
.zinit-load-snippet() {
|
||||
typeset -F 3 SECONDS=0
|
||||
local -a opts
|
||||
zparseopts -E -D -a opts f -command || { print -r -- "Incorrect options (accepted ones: -f, --command)"; return 1; }
|
||||
local url="$1"
|
||||
integer correct retval exists
|
||||
[[ -o ksharrays ]] && correct=1
|
||||
|
||||
[[ -n ${ZINIT_ICE[(i)(\!|)(sh|bash|ksh|csh)]} ]] && {
|
||||
local -a precm
|
||||
precm=(
|
||||
emulate
|
||||
${${(M)${ZINIT_ICE[(i)(\!|)(sh|bash|ksh|csh)]}#\!}:+-R}
|
||||
${${ZINIT_ICE[(i)(\!|)(sh|bash|ksh|csh)]}#\!}
|
||||
${${ZINIT_ICE[(i)(\!|)bash]}:+-${(s: :):-o noshglob -o braceexpand -o kshglob}}
|
||||
-c
|
||||
)
|
||||
}
|
||||
# Remove leading whitespace and trailing /
|
||||
url="${${url#"${url%%[! $'\t']*}"}%/}"
|
||||
ZINIT_ICE[teleid]="$url"
|
||||
[[ ${ZINIT_ICE[as]} = null ]] && \
|
||||
ZINIT_ICE[pick]="${ZINIT_ICE[pick]:-/dev/null}"
|
||||
|
||||
local local_dir dirname filename save_url="$url"
|
||||
|
||||
# Allow things like $OSTYPE in the URL
|
||||
eval "url=\"$url\""
|
||||
|
||||
local id_as="${ZINIT_ICE[id-as]:-$url}"
|
||||
|
||||
# Set up param'' objects (parameters)
|
||||
.zinit-setup-params && \
|
||||
for REPLY ( ${reply[@]} ) {
|
||||
local ${REPLY%%=*}=${REPLY#*=}
|
||||
}
|
||||
|
||||
.zinit-pack-ice "$id_as" ""
|
||||
|
||||
# Oh-My-Zsh, Prezto and manual shorthands
|
||||
[[ $url = *(OMZ::|robbyrussell*oh-my-zsh|ohmyzsh/ohmyzsh)* ]] && local ZSH="${ZINIT[SNIPPETS_DIR]}"
|
||||
(( ${+ZINIT_ICE[svn]} )) && {
|
||||
url[1-correct,5-correct]="${ZINIT_1MAP[${url[1-correct,5-correct]}]:-${url[1-correct,5-correct]}}"
|
||||
} || {
|
||||
url[1-correct,5-correct]="${ZINIT_2MAP[${url[1-correct,5-correct]}]:-${url[1-correct,5-correct]}}"
|
||||
}
|
||||
|
||||
# Construct containing directory, extract final directory
|
||||
# into handy-variable $dirname
|
||||
.zinit-get-object-path snippet "$id_as"
|
||||
filename="${reply[-2]}" dirname="${reply[-2]}"
|
||||
local_dir="${reply[-3]}" exists=${reply[-1]}
|
||||
|
||||
local -a arr
|
||||
local key
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:preinit <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" preinit || \
|
||||
return $(( 10 - $? ))
|
||||
done
|
||||
|
||||
# Download or copy the file
|
||||
if [[ -n ${opts[(r)-f]} || $exists -eq 0 ]] {
|
||||
(( ${+functions[.zinit-download-snippet]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh"
|
||||
[[ $url = *github.com* && $url != */raw/* ]] && url="${${url/\/blob\///raw/}/\/tree\///raw/}"
|
||||
.zinit-download-snippet "$save_url" "$url" "$id_as" "$local_dir" "$dirname" "$filename"
|
||||
retval=$?
|
||||
}
|
||||
|
||||
(( ${+ZINIT_ICE[cloneonly]} || retval )) && return 0
|
||||
|
||||
ZINIT_SNIPPETS[$id_as]="$id_as <${${ZINIT_ICE[svn]+svn}:-single file}>"
|
||||
|
||||
ZINIT[CUR_USPL2]="$id_as" ZINIT_REPORTS[$id_as]=
|
||||
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:\\\!atinit <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" \!atinit || \
|
||||
return $(( 10 - $? ))
|
||||
done
|
||||
|
||||
(( ${+ZINIT_ICE[atinit]} )) && { local __oldcd="$PWD"; (( ${+ZINIT_ICE[nocd]} == 0 )) && { () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; } && eval "${ZINIT_ICE[atinit]}"; ((1)); } || eval "${ZINIT_ICE[atinit]}"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; }
|
||||
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:atinit <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" atinit || \
|
||||
return $(( 10 - $? ))
|
||||
done
|
||||
|
||||
local -a list
|
||||
local ZERO
|
||||
|
||||
if [[ -z ${opts[(r)--command]} && ( -z ${ZINIT_ICE[as]} || ${ZINIT_ICE[as]} = null ) ]]; then
|
||||
# Source the file with compdef shadowing
|
||||
if [[ ${ZINIT[SHADOWING]} = inactive ]]; then
|
||||
# Shadowing code is inlined from .zinit-shadow-on
|
||||
(( ${+functions[compdef]} )) && ZINIT[bkp-compdef]="${functions[compdef]}" || builtin unset "ZINIT[bkp-compdef]"
|
||||
functions[compdef]=':zinit-shadow-compdef "$@";'
|
||||
ZINIT[SHADOWING]=1
|
||||
else
|
||||
(( ++ ZINIT[SHADOWING] ))
|
||||
fi
|
||||
|
||||
# Add to fpath
|
||||
if [[ -d $local_dir/$dirname/functions ]] {
|
||||
[[ -z ${fpath[(r)$local_dir/$dirname/functions]} ]] && fpath+=( "$local_dir/$dirname/functions" )
|
||||
() {
|
||||
builtin setopt localoptions extendedglob
|
||||
autoload $local_dir/$dirname/functions/^([_.]*|prompt_*_setup|README*)(D-.N:t)
|
||||
}
|
||||
}
|
||||
|
||||
# Source
|
||||
if (( ${+ZINIT_ICE[svn]} == 0 )) {
|
||||
[[ ${+ZINIT_ICE[pick]} = 0 ]] && list=( "$local_dir/$dirname/$filename" )
|
||||
[[ -n ${ZINIT_ICE[pick]} ]] && list=( ${(M)~ZINIT_ICE[pick]##/*}(DN) $local_dir/$dirname/${~ZINIT_ICE[pick]}(DN) )
|
||||
} else {
|
||||
if [[ -n ${ZINIT_ICE[pick]} ]]; then
|
||||
list=( ${(M)~ZINIT_ICE[pick]##/*}(DN) $local_dir/$dirname/${~ZINIT_ICE[pick]}(DN) )
|
||||
elif (( ${+ZINIT_ICE[pick]} == 0 )); then
|
||||
.zinit-find-other-matches "$local_dir/$dirname" "$filename"
|
||||
list=( ${reply[@]} )
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ -f ${list[1-correct]} ]] {
|
||||
ZERO="${list[1-correct]}"
|
||||
(( ${+ZINIT_ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }
|
||||
(( 0 == retval )) && [[ $url = PZT::* || $url = https://github.com/sorin-ionescu/prezto/* ]] && zstyle ":prezto:module:${${id_as%/init.zsh}:t}" loaded 'yes'
|
||||
} else { [[ ${+ZINIT_ICE[pick]} = 1 && -z ${ZINIT_ICE[pick]} || ${ZINIT_ICE[pick]} = /dev/null ]] || { +zinit-message "Snippet not loaded ([info2]$id_as[rst])"; retval=1; } }
|
||||
|
||||
[[ -n ${ZINIT_ICE[src]} ]] && { ZERO="${${(M)ZINIT_ICE[src]##/*}:-$local_dir/$dirname/${ZINIT_ICE[src]}}"; (( ${+ZINIT_ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }; }
|
||||
[[ -n ${ZINIT_ICE[multisrc]} ]] && { local __oldcd="$PWD"; () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; }; eval "reply=(${ZINIT_ICE[multisrc]})"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; local fname; for fname in "${reply[@]}"; do ZERO="${${(M)fname:#/*}:-$local_dir/$dirname/$fname}"; (( ${+ZINIT_ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }; done; }
|
||||
|
||||
# Run the atload hooks right before atload ice
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:\\\!atload <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" \!atload
|
||||
done
|
||||
|
||||
# Run the functions' wrapping & tracking requests
|
||||
[[ -n ${ZINIT_ICE[wrap-track]} ]] && \
|
||||
.zinit-wrap-track-functions "$save_url" "" "$id_as"
|
||||
|
||||
[[ ${ZINIT_ICE[atload][1]} = "!" ]] && { .zinit-add-report "$id_as" "Note: Starting to track the atload'!…' ice…"; ZERO="$local_dir/$dirname/-atload-"; local __oldcd="$PWD"; (( ${+ZINIT_ICE[nocd]} == 0 )) && { () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; } && builtin eval "${ZINIT_ICE[atload]#\!}"; ((1)); } || eval "${ZINIT_ICE[atload]#\!}"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; }
|
||||
|
||||
(( -- ZINIT[SHADOWING] == 0 )) && { ZINIT[SHADOWING]=inactive; builtin setopt noaliases; (( ${+ZINIT[bkp-compdef]} )) && functions[compdef]="${ZINIT[bkp-compdef]}" || unfunction compdef; builtin setopt aliases; }
|
||||
elif [[ -n ${opts[(r)--command]} || ${ZINIT_ICE[as]} = command ]]; then
|
||||
[[ ${+ZINIT_ICE[pick]} = 1 && -z ${ZINIT_ICE[pick]} ]] && \
|
||||
ZINIT_ICE[pick]="${id_as:t}"
|
||||
# Subversion - directory and multiple files possible
|
||||
if (( ${+ZINIT_ICE[svn]} )); then
|
||||
if [[ -n ${ZINIT_ICE[pick]} ]]; then
|
||||
list=( ${(M)~ZINIT_ICE[pick]##/*}(DN) $local_dir/$dirname/${~ZINIT_ICE[pick]}(DN) )
|
||||
[[ -n ${list[1-correct]} ]] && local xpath="${list[1-correct]:h}" xfilepath="${list[1-correct]}"
|
||||
else
|
||||
local xpath="$local_dir/$dirname"
|
||||
fi
|
||||
else
|
||||
local xpath="$local_dir/$dirname" xfilepath="$local_dir/$dirname/$filename"
|
||||
# This doesn't make sense, but users may come up with something
|
||||
[[ -n ${ZINIT_ICE[pick]} ]] && {
|
||||
list=( ${(M)~ZINIT_ICE[pick]##/*}(DN) $local_dir/$dirname/${~ZINIT_ICE[pick]}(DN) )
|
||||
[[ -n ${list[1-correct]} ]] && xpath="${list[1-correct]:h}" xfilepath="${list[1-correct]}"
|
||||
}
|
||||
fi
|
||||
[[ -n $xpath && -z ${path[(er)$xpath]} ]] && path=( "${xpath%/}" ${path[@]} )
|
||||
[[ -n $xfilepath && -f $xfilepath && ! -x "$xfilepath" ]] && command chmod a+x "$xfilepath" ${list[@]:#$xfilepath}
|
||||
[[ -n ${ZINIT_ICE[src]} || -n ${ZINIT_ICE[multisrc]} || ${ZINIT_ICE[atload][1]} = "!" ]] && {
|
||||
if [[ ${ZINIT[SHADOWING]} = inactive ]]; then
|
||||
# Shadowing code is inlined from .zinit-shadow-on
|
||||
(( ${+functions[compdef]} )) && ZINIT[bkp-compdef]="${functions[compdef]}" || builtin unset "ZINIT[bkp-compdef]"
|
||||
functions[compdef]=':zinit-shadow-compdef "$@";'
|
||||
ZINIT[SHADOWING]=1
|
||||
else
|
||||
(( ++ ZINIT[SHADOWING] ))
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ -n ${ZINIT_ICE[src]} ]]; then
|
||||
ZERO="${${(M)ZINIT_ICE[src]##/*}:-$local_dir/$dirname/${ZINIT_ICE[src]}}"
|
||||
(( ${+ZINIT_ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }
|
||||
fi
|
||||
[[ -n ${ZINIT_ICE[multisrc]} ]] && { local __oldcd="$PWD"; () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; }; eval "reply=(${ZINIT_ICE[multisrc]})"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; local fname; for fname in "${reply[@]}"; do ZERO="${${(M)fname:#/*}:-$local_dir/$dirname/$fname}"; (( ${+ZINIT_ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }; done; }
|
||||
|
||||
# Run the atload hooks right before atload ice
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:\\\!atload <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" \!atload
|
||||
done
|
||||
|
||||
# Run the functions' wrapping & tracking requests
|
||||
[[ -n ${ZINIT_ICE[wrap-track]} ]] && \
|
||||
.zinit-wrap-track-functions "$save_url" "" "$id_as"
|
||||
|
||||
[[ ${ZINIT_ICE[atload][1]} = "!" ]] && { .zinit-add-report "$id_as" "Note: Starting to track the atload'!…' ice…"; ZERO="$local_dir/$dirname/-atload-"; local __oldcd="$PWD"; (( ${+ZINIT_ICE[nocd]} == 0 )) && { () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; } && builtin eval "${ZINIT_ICE[atload]#\!}"; ((1)); } || eval "${ZINIT_ICE[atload]#\!}"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; }
|
||||
|
||||
[[ -n ${ZINIT_ICE[src]} || -n ${ZINIT_ICE[multisrc]} || ${ZINIT_ICE[atload][1]} = "!" ]] && {
|
||||
(( -- ZINIT[SHADOWING] == 0 )) && { ZINIT[SHADOWING]=inactive; builtin setopt noaliases; (( ${+ZINIT[bkp-compdef]} )) && functions[compdef]="${ZINIT[bkp-compdef]}" || unfunction compdef; builtin setopt aliases; }
|
||||
}
|
||||
elif [[ ${ZINIT_ICE[as]} = completion ]]; then
|
||||
((1))
|
||||
fi
|
||||
|
||||
(( ${+ZINIT_ICE[atload]} )) && [[ ${ZINIT_ICE[atload][1]} != "!" ]] && { ZERO="$local_dir/$dirname/-atload-"; local __oldcd="$PWD"; (( ${+ZINIT_ICE[nocd]} == 0 )) && { () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; } && builtin eval "${ZINIT_ICE[atload]}"; ((1)); } || eval "${ZINIT_ICE[atload]}"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; }
|
||||
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:atload <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" atload
|
||||
done
|
||||
|
||||
(( ${+ZINIT_ICE[notify]} == 1 )) && { [[ $retval -eq 0 || -n ${(M)ZINIT_ICE[notify]#\!} ]] && { local msg; eval "msg=\"${ZINIT_ICE[notify]#\!}\""; .zinit-deploy-message @msg "$msg" } || .zinit-deploy-message @msg "notify: Plugin not loaded / loaded with problem, the return code: $retval"; }
|
||||
(( ${+ZINIT_ICE[reset-prompt]} == 1 )) && .zinit-deploy-message @rst
|
||||
|
||||
ZINIT[CUR_USPL2]=
|
||||
ZINIT[TIME_INDEX]=$(( ${ZINIT[TIME_INDEX]:-0} + 1 ))
|
||||
ZINIT[TIME_${ZINIT[TIME_INDEX]}_${id_as}]=$SECONDS
|
||||
ZINIT[AT_TIME_${ZINIT[TIME_INDEX]}_${id_as}]=$EPOCHREALTIME
|
||||
return $retval
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-compdef-replay [[[
|
||||
# Runs gathered compdef calls. This allows to run `compinit'
|
||||
# after loading plugins.
|
||||
.zinit-compdef-replay() {
|
||||
local quiet="$1"
|
||||
typeset -a pos
|
||||
|
||||
# Check if compinit was loaded
|
||||
if [[ ${+functions[compdef]} = 0 ]]; then
|
||||
+zinit-message "Compinit isn't loaded, cannot do compdef replay"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# In the same order
|
||||
local cdf
|
||||
for cdf in "${ZINIT_COMPDEF_REPLAY[@]}"; do
|
||||
pos=( "${(z)cdf}" )
|
||||
# When ZINIT_COMPDEF_REPLAY empty (also when only white spaces)
|
||||
[[ ${#pos[@]} = 1 && -z ${pos[-1]} ]] && continue
|
||||
pos=( "${(Q)pos[@]}" )
|
||||
[[ $quiet = -q ]] || +zinit-message "Running compdef: [obj]${pos[*]}[rst]"
|
||||
compdef "${pos[@]}"
|
||||
done
|
||||
|
||||
return 0
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-compdef-clear [[[
|
||||
# Implements user-exposed functionality to clear gathered compdefs.
|
||||
.zinit-compdef-clear() {
|
||||
local quiet="$1" count="${#ZINIT_COMPDEF_REPLAY}"
|
||||
ZINIT_COMPDEF_REPLAY=( )
|
||||
[[ $quiet = -q ]] || +zinit-message "Compdef-replay cleared (had [obj]${count}[rst] entries)"
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-add-report [[[
|
||||
# Adds a report line for given plugin.
|
||||
#
|
||||
# $1 - uspl2, i.e. user/plugin
|
||||
# $2, ... - the text
|
||||
.zinit-add-report() {
|
||||
# Use zinit binary module if available
|
||||
[[ -n $1 ]] && { (( ${+builtins[zpmod]} && 0 )) && zpmod report-append "$1" "$2"$'\n' || ZINIT_REPORTS[$1]+="$2"$'\n'; }
|
||||
[[ ${ZINIT[DTRACE]} = 1 ]] && { (( ${+builtins[zpmod]} )) && zpmod report-append _dtrace/_dtrace "$2"$'\n' || ZINIT_REPORTS[_dtrace/_dtrace]+="$2"$'\n'; }
|
||||
return 0
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-load-plugin [[[
|
||||
# Lower-level function for loading a plugin.
|
||||
#
|
||||
|
|
@ -1188,14 +1469,16 @@ function $f {
|
|||
ZINIT[CUR_USR]="$user" ZINIT[CUR_PLUGIN]="$plugin" ZINIT[CUR_USPL2]="$id_as"
|
||||
[[ -o ksharrays ]] && correct=1
|
||||
|
||||
[[ -n ${ZINIT_ICE[(i)(\!|)(sh|bash|ksh|csh)]} ]] && \
|
||||
local -a precm=(
|
||||
[[ -n ${ZINIT_ICE[(i)(\!|)(sh|bash|ksh|csh)]} ]] && {
|
||||
local -a precm
|
||||
precm=(
|
||||
emulate
|
||||
${${(M)${ZINIT_ICE[(i)(\!|)(sh|bash|ksh|csh)]}#\!}:+-R}
|
||||
${${ZINIT_ICE[(i)(\!|)(sh|bash|ksh|csh)]}#\!}
|
||||
${${ZINIT_ICE[(i)(\!|)bash]}:+-${(s: :):-o noshglob -o braceexpand -o kshglob}}
|
||||
-c
|
||||
)
|
||||
}
|
||||
|
||||
[[ ${ZINIT_ICE[as]} = null ]] && \
|
||||
ZINIT_ICE[pick]="${ZINIT_ICE[pick]:-/dev/null}"
|
||||
|
|
@ -1204,6 +1487,12 @@ function $f {
|
|||
[[ $user = % ]] && local pdir_path="$plugin" || local pdir_path="${ZINIT[PLUGINS_DIR]}/${id_as//\//---}"
|
||||
local pdir_orig="$pdir_path" key
|
||||
|
||||
# Set up param'' objects (parameters)
|
||||
.zinit-setup-params && \
|
||||
for REPLY ( ${reply[@]} ) {
|
||||
local ${REPLY%%=*}=${REPLY#*=}
|
||||
}
|
||||
|
||||
if [[ ${ZINIT_ICE[as]} = command ]]; then
|
||||
[[ ${+ZINIT_ICE[pick]} = 1 && -z ${ZINIT_ICE[pick]} ]] && \
|
||||
ZINIT_ICE[pick]="${id_as:t}"
|
||||
|
|
@ -1318,272 +1607,6 @@ function $f {
|
|||
(( $5 )) && { print; zle .reset-prompt; }
|
||||
return $retval
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-load-snippet [[[
|
||||
# Implements the exposed-to-user action of loading a snippet.
|
||||
#
|
||||
# $1 - url (can be local, absolute path)
|
||||
.zinit-load-snippet() {
|
||||
typeset -F 3 SECONDS=0
|
||||
local -a opts
|
||||
zparseopts -E -D -a opts f -command || { print -r -- "Incorrect options (accepted ones: -f, --command)"; return 1; }
|
||||
local url="$1"
|
||||
integer correct retval exists
|
||||
[[ -o ksharrays ]] && correct=1
|
||||
|
||||
[[ -n ${ZINIT_ICE[(i)(\!|)(sh|bash|ksh|csh)]} ]] && \
|
||||
local -a precm=(
|
||||
emulate
|
||||
${${(M)${ZINIT_ICE[(i)(\!|)(sh|bash|ksh|csh)]}#\!}:+-R}
|
||||
${${ZINIT_ICE[(i)(\!|)(sh|bash|ksh|csh)]}#\!}
|
||||
${${ZINIT_ICE[(i)(\!|)bash]}:+-${(s: :):-o noshglob -o braceexpand -o kshglob}}
|
||||
-c
|
||||
)
|
||||
# Remove leading whitespace and trailing /
|
||||
url="${${url#"${url%%[! $'\t']*}"}%/}"
|
||||
ZINIT_ICE[teleid]="$url"
|
||||
[[ ${ZINIT_ICE[as]} = null ]] && \
|
||||
ZINIT_ICE[pick]="${ZINIT_ICE[pick]:-/dev/null}"
|
||||
|
||||
local local_dir dirname filename save_url="$url"
|
||||
|
||||
# Allow things like $OSTYPE in the URL
|
||||
eval "url=\"$url\""
|
||||
|
||||
local id_as="${ZINIT_ICE[id-as]:-$url}"
|
||||
|
||||
.zinit-pack-ice "$id_as" ""
|
||||
|
||||
# Oh-My-Zsh, Prezto and manual shorthands
|
||||
[[ $url = *(OMZ::|robbyrussell*oh-my-zsh|ohmyzsh/ohmyzsh)* ]] && local ZSH="${ZINIT[SNIPPETS_DIR]}"
|
||||
(( ${+ZINIT_ICE[svn]} )) && {
|
||||
url[1-correct,5-correct]="${ZINIT_1MAP[${url[1-correct,5-correct]}]:-${url[1-correct,5-correct]}}"
|
||||
} || {
|
||||
url[1-correct,5-correct]="${ZINIT_2MAP[${url[1-correct,5-correct]}]:-${url[1-correct,5-correct]}}"
|
||||
}
|
||||
|
||||
# Construct containing directory, extract final directory
|
||||
# into handy-variable $dirname
|
||||
.zinit-get-object-path snippet "$id_as"
|
||||
filename="${reply[-2]}" dirname="${reply[-2]}"
|
||||
local_dir="${reply[-3]}" exists=${reply[-1]}
|
||||
|
||||
local -a arr
|
||||
local key
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:preinit <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" preinit || \
|
||||
return $(( 10 - $? ))
|
||||
done
|
||||
|
||||
# Download or copy the file
|
||||
if [[ -n ${opts[(r)-f]} || $exists -eq 0 ]] {
|
||||
(( ${+functions[.zinit-download-snippet]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh"
|
||||
[[ $url = *github.com* && $url != */raw/* ]] && url="${${url/\/blob\///raw/}/\/tree\///raw/}"
|
||||
.zinit-download-snippet "$save_url" "$url" "$id_as" "$local_dir" "$dirname" "$filename"
|
||||
retval=$?
|
||||
}
|
||||
|
||||
(( ${+ZINIT_ICE[cloneonly]} || retval )) && return 0
|
||||
|
||||
ZINIT_SNIPPETS[$id_as]="$id_as <${${ZINIT_ICE[svn]+svn}:-single file}>"
|
||||
|
||||
ZINIT[CUR_USPL2]="$id_as" ZINIT_REPORTS[$id_as]=
|
||||
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:\\\!atinit <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" \!atinit || \
|
||||
return $(( 10 - $? ))
|
||||
done
|
||||
|
||||
(( ${+ZINIT_ICE[atinit]} )) && { local __oldcd="$PWD"; (( ${+ZINIT_ICE[nocd]} == 0 )) && { () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; } && eval "${ZINIT_ICE[atinit]}"; ((1)); } || eval "${ZINIT_ICE[atinit]}"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; }
|
||||
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:atinit <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" atinit || \
|
||||
return $(( 10 - $? ))
|
||||
done
|
||||
|
||||
local -a list
|
||||
local ZERO
|
||||
|
||||
if [[ -z ${opts[(r)--command]} && ( -z ${ZINIT_ICE[as]} || ${ZINIT_ICE[as]} = null ) ]]; then
|
||||
# Source the file with compdef shadowing
|
||||
if [[ ${ZINIT[SHADOWING]} = inactive ]]; then
|
||||
# Shadowing code is inlined from .zinit-shadow-on
|
||||
(( ${+functions[compdef]} )) && ZINIT[bkp-compdef]="${functions[compdef]}" || builtin unset "ZINIT[bkp-compdef]"
|
||||
functions[compdef]=':zinit-shadow-compdef "$@";'
|
||||
ZINIT[SHADOWING]=1
|
||||
else
|
||||
(( ++ ZINIT[SHADOWING] ))
|
||||
fi
|
||||
|
||||
# Add to fpath
|
||||
if [[ -d $local_dir/$dirname/functions ]] {
|
||||
[[ -z ${fpath[(r)$local_dir/$dirname/functions]} ]] && fpath+=( "$local_dir/$dirname/functions" )
|
||||
() {
|
||||
builtin setopt localoptions extendedglob
|
||||
autoload $local_dir/$dirname/functions/^([_.]*|prompt_*_setup|README*)(D-.N:t)
|
||||
}
|
||||
}
|
||||
|
||||
# Source
|
||||
if (( ${+ZINIT_ICE[svn]} == 0 )) {
|
||||
[[ ${+ZINIT_ICE[pick]} = 0 ]] && list=( "$local_dir/$dirname/$filename" )
|
||||
[[ -n ${ZINIT_ICE[pick]} ]] && list=( ${(M)~ZINIT_ICE[pick]##/*}(DN) $local_dir/$dirname/${~ZINIT_ICE[pick]}(DN) )
|
||||
} else {
|
||||
if [[ -n ${ZINIT_ICE[pick]} ]]; then
|
||||
list=( ${(M)~ZINIT_ICE[pick]##/*}(DN) $local_dir/$dirname/${~ZINIT_ICE[pick]}(DN) )
|
||||
elif (( ${+ZINIT_ICE[pick]} == 0 )); then
|
||||
.zinit-find-other-matches "$local_dir/$dirname" "$filename"
|
||||
list=( ${reply[@]} )
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ -f ${list[1-correct]} ]] {
|
||||
ZERO="${list[1-correct]}"
|
||||
(( ${+ZINIT_ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }
|
||||
(( 0 == retval )) && [[ $url = PZT::* || $url = https://github.com/sorin-ionescu/prezto/* ]] && zstyle ":prezto:module:${${id_as%/init.zsh}:t}" loaded 'yes'
|
||||
} else { [[ ${+ZINIT_ICE[pick]} = 1 && -z ${ZINIT_ICE[pick]} || ${ZINIT_ICE[pick]} = /dev/null ]] || { print -r -- "Snippet not loaded ($id_as)"; retval=1; } }
|
||||
|
||||
[[ -n ${ZINIT_ICE[src]} ]] && { ZERO="${${(M)ZINIT_ICE[src]##/*}:-$local_dir/$dirname/${ZINIT_ICE[src]}}"; (( ${+ZINIT_ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }; }
|
||||
[[ -n ${ZINIT_ICE[multisrc]} ]] && { local __oldcd="$PWD"; () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; }; eval "reply=(${ZINIT_ICE[multisrc]})"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; local fname; for fname in "${reply[@]}"; do ZERO="${${(M)fname:#/*}:-$local_dir/$dirname/$fname}"; (( ${+ZINIT_ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }; done; }
|
||||
|
||||
# Run the atload hooks right before atload ice
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:\\\!atload <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" \!atload
|
||||
done
|
||||
|
||||
# Run the functions' wrapping & tracking requests
|
||||
[[ -n ${ZINIT_ICE[wrap-track]} ]] && \
|
||||
.zinit-wrap-track-functions "$save_url" "" "$id_as"
|
||||
|
||||
[[ ${ZINIT_ICE[atload][1]} = "!" ]] && { .zinit-add-report "$id_as" "Note: Starting to track the atload'!…' ice…"; ZERO="$local_dir/$dirname/-atload-"; local __oldcd="$PWD"; (( ${+ZINIT_ICE[nocd]} == 0 )) && { () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; } && builtin eval "${ZINIT_ICE[atload]#\!}"; ((1)); } || eval "${ZINIT_ICE[atload]#\!}"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; }
|
||||
|
||||
(( -- ZINIT[SHADOWING] == 0 )) && { ZINIT[SHADOWING]=inactive; builtin setopt noaliases; (( ${+ZINIT[bkp-compdef]} )) && functions[compdef]="${ZINIT[bkp-compdef]}" || unfunction compdef; builtin setopt aliases; }
|
||||
elif [[ -n ${opts[(r)--command]} || ${ZINIT_ICE[as]} = command ]]; then
|
||||
[[ ${+ZINIT_ICE[pick]} = 1 && -z ${ZINIT_ICE[pick]} ]] && \
|
||||
ZINIT_ICE[pick]="${id_as:t}"
|
||||
# Subversion - directory and multiple files possible
|
||||
if (( ${+ZINIT_ICE[svn]} )); then
|
||||
if [[ -n ${ZINIT_ICE[pick]} ]]; then
|
||||
list=( ${(M)~ZINIT_ICE[pick]##/*}(DN) $local_dir/$dirname/${~ZINIT_ICE[pick]}(DN) )
|
||||
[[ -n ${list[1-correct]} ]] && local xpath="${list[1-correct]:h}" xfilepath="${list[1-correct]}"
|
||||
else
|
||||
local xpath="$local_dir/$dirname"
|
||||
fi
|
||||
else
|
||||
local xpath="$local_dir/$dirname" xfilepath="$local_dir/$dirname/$filename"
|
||||
# This doesn't make sense, but users may come up with something
|
||||
[[ -n ${ZINIT_ICE[pick]} ]] && {
|
||||
list=( ${(M)~ZINIT_ICE[pick]##/*}(DN) $local_dir/$dirname/${~ZINIT_ICE[pick]}(DN) )
|
||||
[[ -n ${list[1-correct]} ]] && xpath="${list[1-correct]:h}" xfilepath="${list[1-correct]}"
|
||||
}
|
||||
fi
|
||||
[[ -n $xpath && -z ${path[(er)$xpath]} ]] && path=( "${xpath%/}" ${path[@]} )
|
||||
[[ -n $xfilepath && -f $xfilepath && ! -x "$xfilepath" ]] && command chmod a+x "$xfilepath" ${list[@]:#$xfilepath}
|
||||
[[ -n ${ZINIT_ICE[src]} || -n ${ZINIT_ICE[multisrc]} || ${ZINIT_ICE[atload][1]} = "!" ]] && {
|
||||
if [[ ${ZINIT[SHADOWING]} = inactive ]]; then
|
||||
# Shadowing code is inlined from .zinit-shadow-on
|
||||
(( ${+functions[compdef]} )) && ZINIT[bkp-compdef]="${functions[compdef]}" || builtin unset "ZINIT[bkp-compdef]"
|
||||
functions[compdef]=':zinit-shadow-compdef "$@";'
|
||||
ZINIT[SHADOWING]=1
|
||||
else
|
||||
(( ++ ZINIT[SHADOWING] ))
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ -n ${ZINIT_ICE[src]} ]]; then
|
||||
ZERO="${${(M)ZINIT_ICE[src]##/*}:-$local_dir/$dirname/${ZINIT_ICE[src]}}"
|
||||
(( ${+ZINIT_ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }
|
||||
fi
|
||||
[[ -n ${ZINIT_ICE[multisrc]} ]] && { local __oldcd="$PWD"; () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; }; eval "reply=(${ZINIT_ICE[multisrc]})"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; local fname; for fname in "${reply[@]}"; do ZERO="${${(M)fname:#/*}:-$local_dir/$dirname/$fname}"; (( ${+ZINIT_ICE[silent]} )) && { { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; } 2>/dev/null 1>&2; (( retval += $? )); ((1)); } || { ((1)); { [[ -n $precm ]] && { builtin ${precm[@]} 'source "$ZERO"'; ((1)); } || { ((1)); builtin source "$ZERO"; }; }; (( retval += $? )); }; done; }
|
||||
|
||||
# Run the atload hooks right before atload ice
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:\\\!atload <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" \!atload
|
||||
done
|
||||
|
||||
# Run the functions' wrapping & tracking requests
|
||||
[[ -n ${ZINIT_ICE[wrap-track]} ]] && \
|
||||
.zinit-wrap-track-functions "$save_url" "" "$id_as"
|
||||
|
||||
[[ ${ZINIT_ICE[atload][1]} = "!" ]] && { .zinit-add-report "$id_as" "Note: Starting to track the atload'!…' ice…"; ZERO="$local_dir/$dirname/-atload-"; local __oldcd="$PWD"; (( ${+ZINIT_ICE[nocd]} == 0 )) && { () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; } && builtin eval "${ZINIT_ICE[atload]#\!}"; ((1)); } || eval "${ZINIT_ICE[atload]#\!}"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; }
|
||||
|
||||
[[ -n ${ZINIT_ICE[src]} || -n ${ZINIT_ICE[multisrc]} || ${ZINIT_ICE[atload][1]} = "!" ]] && {
|
||||
(( -- ZINIT[SHADOWING] == 0 )) && { ZINIT[SHADOWING]=inactive; builtin setopt noaliases; (( ${+ZINIT[bkp-compdef]} )) && functions[compdef]="${ZINIT[bkp-compdef]}" || unfunction compdef; builtin setopt aliases; }
|
||||
}
|
||||
elif [[ ${ZINIT_ICE[as]} = completion ]]; then
|
||||
((1))
|
||||
fi
|
||||
|
||||
(( ${+ZINIT_ICE[atload]} )) && [[ ${ZINIT_ICE[atload][1]} != "!" ]] && { ZERO="$local_dir/$dirname/-atload-"; local __oldcd="$PWD"; (( ${+ZINIT_ICE[nocd]} == 0 )) && { () { setopt localoptions noautopushd; builtin cd -q "$local_dir/$dirname"; } && builtin eval "${ZINIT_ICE[atload]}"; ((1)); } || eval "${ZINIT_ICE[atload]}"; () { setopt localoptions noautopushd; builtin cd -q "$__oldcd"; }; }
|
||||
|
||||
reply=( "${(@on)ZINIT_EXTS[(I)z-annex hook:atload <->]}" )
|
||||
for key in "${reply[@]}"; do
|
||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]}[@]}" )
|
||||
"${arr[5]}" snippet "$save_url" "$id_as" "$local_dir/$dirname" atload
|
||||
done
|
||||
|
||||
(( ${+ZINIT_ICE[notify]} == 1 )) && { [[ $retval -eq 0 || -n ${(M)ZINIT_ICE[notify]#\!} ]] && { local msg; eval "msg=\"${ZINIT_ICE[notify]#\!}\""; .zinit-deploy-message @msg "$msg" } || .zinit-deploy-message @msg "notify: Plugin not loaded / loaded with problem, the return code: $retval"; }
|
||||
(( ${+ZINIT_ICE[reset-prompt]} == 1 )) && .zinit-deploy-message @rst
|
||||
|
||||
ZINIT[CUR_USPL2]=
|
||||
ZINIT[TIME_INDEX]=$(( ${ZINIT[TIME_INDEX]:-0} + 1 ))
|
||||
ZINIT[TIME_${ZINIT[TIME_INDEX]}_${id_as}]=$SECONDS
|
||||
ZINIT[AT_TIME_${ZINIT[TIME_INDEX]}_${id_as}]=$EPOCHREALTIME
|
||||
return $retval
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-compdef-replay [[[
|
||||
# Runs gathered compdef calls. This allows to run `compinit'
|
||||
# after loading plugins.
|
||||
.zinit-compdef-replay() {
|
||||
local quiet="$1"
|
||||
typeset -a pos
|
||||
|
||||
# Check if compinit was loaded
|
||||
if [[ ${+functions[compdef]} = 0 ]]; then
|
||||
print "Compinit isn't loaded, cannot do compdef replay"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# In the same order
|
||||
local cdf
|
||||
for cdf in "${ZINIT_COMPDEF_REPLAY[@]}"; do
|
||||
pos=( "${(z)cdf}" )
|
||||
# When ZINIT_COMPDEF_REPLAY empty (also when only white spaces)
|
||||
[[ ${#pos[@]} = 1 && -z ${pos[-1]} ]] && continue
|
||||
pos=( "${(Q)pos[@]}" )
|
||||
[[ $quiet = -q ]] || print "Running compdef ${pos[*]}"
|
||||
compdef "${pos[@]}"
|
||||
done
|
||||
|
||||
return 0
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-compdef-clear [[[
|
||||
# Implements user-exposed functionality to clear gathered compdefs.
|
||||
.zinit-compdef-clear() {
|
||||
local quiet="$1" count="${#ZINIT_COMPDEF_REPLAY}"
|
||||
ZINIT_COMPDEF_REPLAY=( )
|
||||
[[ $quiet = -q ]] || print "Compdef-replay cleared (had $count entries)"
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-add-report [[[
|
||||
# Adds a report line for given plugin.
|
||||
#
|
||||
# $1 - uspl2, i.e. user/plugin
|
||||
# $2, ... - the text
|
||||
.zinit-add-report() {
|
||||
# Use zinit binary module if available
|
||||
[[ -n $1 ]] && { (( ${+builtins[zpmod]} && 0 )) && zpmod report-append "$1" "$2"$'\n' || ZINIT_REPORTS[$1]+="$2"$'\n'; }
|
||||
[[ ${ZINIT[DTRACE]} = 1 ]] && { (( ${+builtins[zpmod]} )) && zpmod report-append _dtrace/_dtrace "$2"$'\n' || ZINIT_REPORTS[_dtrace/_dtrace]+="$2"$'\n'; }
|
||||
return 0
|
||||
} # ]]]
|
||||
# FUNCTION: .zinit-add-fpath [[[
|
||||
.zinit-add-fpath() {
|
||||
[[ $1 = (-f|--front) ]] && { shift; integer front=1; }
|
||||
|
|
@ -1602,7 +1625,7 @@ function $f {
|
|||
.zinit-run() {
|
||||
if [[ $1 = (-l|--last) ]]; then
|
||||
{ set -- "${ZINIT[last-run-plugin]:-$(<${ZINIT[BIN_DIR]}/last-run-object.txt)}" "${@[2-correct,-1]}"; } &>/dev/null
|
||||
[[ -z $1 ]] && { print "${ZINIT[col-error]}Error: No last plugin available, please specify as the first argument${ZINIT[col-rst]}"; return 1; }
|
||||
[[ -z $1 ]] && { +zinit-message "[error]Error: No last plugin available, please specify as the first argument.[rst]"; return 1; }
|
||||
else
|
||||
integer __nolast=1
|
||||
fi
|
||||
|
|
@ -1621,7 +1644,7 @@ function $f {
|
|||
eval "${@[2-correct,-1]}"
|
||||
() { setopt localoptions noautopushd; builtin cd -q "$__oldpwd"; }
|
||||
else
|
||||
print "${ZINIT[col-error]}Error: no such plugin or snippet${ZINIT[col-rst]}"
|
||||
+zinit-message "[error]Error: no such plugin or snippet.[rst]"
|
||||
fi
|
||||
}
|
||||
# ]]]
|
||||
|
|
@ -1634,7 +1657,7 @@ function $f {
|
|||
# Starts Dtrace, i.e. session tracking for changes in Zsh state.
|
||||
.zinit-debug-start() {
|
||||
if [[ ${ZINIT[DTRACE]} = 1 ]]; then
|
||||
print "${ZINIT[col-error]}Dtrace is already active, stop it first with \`dstop'${ZINIT[col-rst]}"
|
||||
+zinit-message "[error]Dtrace is already active, stop it first with \`dstop'[rst]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
|
@ -1665,7 +1688,7 @@ function $f {
|
|||
# Reverts changes detected by dtrace run.
|
||||
.zinit-debug-unload() {
|
||||
if [[ ${ZINIT[DTRACE]} = 1 ]]; then
|
||||
print "Dtrace is still active, end it with \`dstop'"
|
||||
+zinit-message "[error]Dtrace is still active, stop it first with \`dstop'[rst]"
|
||||
else
|
||||
.zinit-unload _dtrace _dtrace
|
||||
fi
|
||||
|
|
@ -1684,16 +1707,7 @@ function $f {
|
|||
integer retval
|
||||
local bit exts="${~ZINIT_EXTS[ice-mods]//\'\'/}"
|
||||
for bit; do
|
||||
[[ $bit = (#b)(--|)(teleid|from|proto|cloneopts|depth|wait|load|\
|
||||
unload|on-update-of|subscribe|if|has|cloneonly|nocloneonly|blockf|\
|
||||
svn|nosvn|pick|nopick|src|bpick|as|ver|silent|lucid|mv|cp|atinit|\
|
||||
atload|atpull|atclone|run-atpull|norun-atpull|make|nomake|notify|\
|
||||
nonotify|reset-prompt|service|compile|nocompile|nocompletions|multisrc|\
|
||||
id-as|bindmap|trackbinds|notrackbinds|nocd|once|wrap-track|reset|\
|
||||
noreset|sh|\!sh|bash|\!bash|ksh|\!ksh|csh|\!csh|aliases|noaliases|\
|
||||
countdown|nocountdown|trigger-load|light-mode|is-snippet|pack|\
|
||||
atdelete|git|verbose|param|extract${~exts})(*)
|
||||
]] && \
|
||||
[[ $bit = (#b)(--|)(${~ZINIT[ice-list]}${~exts})(*) ]] && \
|
||||
ZINIT_ICES[${match[2]}]+="${ZINIT_ICES[${match[2]}]:+;}${match[3]#(:|=)}" || \
|
||||
break
|
||||
retval+=1
|
||||
|
|
@ -1995,6 +2009,28 @@ atdelete|git|verbose|param|extract${~exts})(*)
|
|||
[[ ${ZINIT[lro-data]##*:} = on ]] && return 0 || return $__ret
|
||||
}
|
||||
# ]]]
|
||||
# FUNCTION: +zinit-message [[[
|
||||
+zinit-message() {
|
||||
builtin emulate -LR zsh -o extendedglob
|
||||
[[ $1 = -n ]] && { local n="-n"; shift }
|
||||
local msg=${(j: :)${@//(#b)\[([^\]]##)\]/$ZINIT[col-$match[1]]}}
|
||||
builtin print -Pr $n -- $msg
|
||||
}
|
||||
# ]]]
|
||||
# FUNCTION: .zinit-setup-params [[[
|
||||
.zinit-setup-params() {
|
||||
emulate -LR zsh -o extendedglob
|
||||
local -a params param_to_value
|
||||
params=( ${(s.;.)ZINIT_ICE[param]} ) reply=( )
|
||||
local param
|
||||
for param ( ${params[@]} ) {
|
||||
param_to_value=( "${param%%(-\>|→)*}" "${${(MS)param##*(-\>|→)}:+${param##*(-\>|→)}}" )
|
||||
param_to_value=( "${param_to_value[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" )
|
||||
reply+=( "${param_to_value[1]}=${param_to_value[2]}" )
|
||||
}
|
||||
(( ${#params} )) && return 0 || return 2
|
||||
}
|
||||
# ]]]
|
||||
|
||||
#
|
||||
# Exposed functions
|
||||
|
|
@ -2010,7 +2046,8 @@ zinit() {
|
|||
|
||||
integer retval=0 correct=0
|
||||
local -a match mbegin mend reply
|
||||
local MATCH REPLY; integer MBEGIN MEND
|
||||
local MATCH REPLY __q="\`" __q2="'"; integer MBEGIN MEND
|
||||
|
||||
|
||||
[[ -o ksharrays ]] && correct=1
|
||||
|
||||
|
|
@ -2039,7 +2076,8 @@ completions|cclear|cdisable|cenable|creinstall|cuninstall|csearch|compinit|dtrac
|
|||
dunload|dreport|dclear|compile|uncompile|compiled|cdlist|cdreplay|cdclear|srv|recall|\
|
||||
env-whitelist|bindkeys|module|add-fpath|fpath|run${reply:+|${(~j:|:)"${reply[@]#z-annex subcommand:}"}}) || $1 = (load|light|snippet) ]] && \
|
||||
{
|
||||
if [[ $1 = (load|light|snippet) ]]; then
|
||||
integer error
|
||||
if [[ $1 = (load|light|snippet) ]] {
|
||||
integer __is_snippet
|
||||
# Classic syntax -> simulate a call through the for-syntax
|
||||
() {
|
||||
|
|
@ -2056,28 +2094,36 @@ env-whitelist|bindkeys|module|add-fpath|fpath|run${reply:+|${(~j:|:)"${reply[@]#
|
|||
1="${1:+@}${1#@}${2:+/$2}"
|
||||
(( $# > 1 )) && { shift -p $(( $# - 1 )); }
|
||||
[[ -z $1 ]] && {
|
||||
print "Argument needed, try: help"
|
||||
+zinit-message "Argument needed, try: [obj]help[rst]."
|
||||
return 1
|
||||
}
|
||||
else
|
||||
} else {
|
||||
.zinit-ice "$@"
|
||||
shift $?
|
||||
if [[ $# -gt 0 && $1 != for ]]; then
|
||||
print "Unknown command or ice: \`$1' (use \`help' to get usage information)"
|
||||
integer retval=$?
|
||||
local last_ice=${@[retval]}
|
||||
shift $retval
|
||||
if [[ $# -gt 0 && $1 != for ]] {
|
||||
+zinit-message "[error]Unknown command or ice: ${__q}[obj]${1}[error]'" \
|
||||
"(use ${__q}[info2]help[error]' to get usage information).[rst]"
|
||||
return 1
|
||||
fi
|
||||
[[ $1 = for ]] && shift
|
||||
fi
|
||||
} elif (( $# == 0 )) {
|
||||
error=1
|
||||
} else {
|
||||
shift
|
||||
}
|
||||
}
|
||||
integer __retval __had_wait
|
||||
if (( $# )); then
|
||||
if (( $# )) {
|
||||
local -a __ices
|
||||
__ices=( "${(kv)ZINIT_ICES[@]}" )
|
||||
ZINIT_ICES=()
|
||||
while (( $# )) {
|
||||
.zinit-ice "$@"
|
||||
shift $?
|
||||
integer retval=$?
|
||||
local last_ice=${@[retval]}
|
||||
shift $retval
|
||||
[[ -z ${ZINIT_ICES[subscribe]} ]] && unset 'ZINIT_ICES[subscribe]'
|
||||
if [[ -n $1 ]]; then
|
||||
if [[ -n $1 ]] {
|
||||
ZINIT_ICE=( "${__ices[@]}" "${(kv)ZINIT_ICES[@]}" )
|
||||
ZINIT_ICES=()
|
||||
|
||||
|
|
@ -2166,11 +2212,31 @@ env-whitelist|bindkeys|module|add-fpath|fpath|run${reply:+|${(~j:|:)"${reply[@]#
|
|||
fi
|
||||
__retval+=$? __is_snippet=0
|
||||
}
|
||||
fi
|
||||
} else {
|
||||
error=1
|
||||
}
|
||||
(( $# )) && shift
|
||||
}
|
||||
fi
|
||||
return __retval
|
||||
} else {
|
||||
error=1
|
||||
}
|
||||
|
||||
if (( error )) {
|
||||
() {
|
||||
emulate -LR zsh -o extendedglob
|
||||
+zinit-message -n "[error]Error: No plugin or snippet ID given"
|
||||
if [[ -n $last_ice ]] {
|
||||
+zinit-message "(the last recognized ice was: [obj]"\
|
||||
"${last_ice/(#m)(${~ZINIT[ice-list]})/[obj]$MATCH${__q2}[file]}[obj]'[error]).
|
||||
You can try to prepend ${__q}[obj]@[error]' if the last ice is in fact a plugin.[rst]"
|
||||
} else {
|
||||
+zinit-message ".[rst]"
|
||||
}
|
||||
}
|
||||
return 2
|
||||
} elif (( ! $# )) {
|
||||
return 2
|
||||
}
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
|
@ -2202,13 +2268,13 @@ env-whitelist|bindkeys|module|add-fpath|fpath|run${reply:+|${(~j:|:)"${reply[@]#
|
|||
(env-whitelist)
|
||||
shift
|
||||
[[ $1 = -v ]] && { shift; local verbose=1; }
|
||||
[[ $1 = -h ]] && { shift; print "Usage: zinit env-whitelist [-v] VAR1 ...\nSaves names (also patterns) of parameters left unchanged during an unload. -v - verbose."; }
|
||||
[[ $1 = -h ]] && { shift; +zinit-message "[info2]Usage:[rst] zinit env-whitelist [-v] VAR1 ...\nSaves names (also patterns) of parameters left unchanged during an unload. -v - verbose."; }
|
||||
(( $# == 0 )) && {
|
||||
ZINIT[ENV-WHITELIST]=
|
||||
(( verbose )) && print "Cleared parameter whitelist"
|
||||
(( verbose )) && +zinit-message "Cleared parameter whitelist"
|
||||
} || {
|
||||
ZINIT[ENV-WHITELIST]+="${(j: :)${(q-kv)@}} "
|
||||
(( verbose )) && print "Extended parameter whitelist"
|
||||
(( verbose )) && +zinit-message "Extended parameter whitelist"
|
||||
}
|
||||
;;
|
||||
(*)
|
||||
|
|
@ -2218,7 +2284,7 @@ env-whitelist|bindkeys|module|add-fpath|fpath|run${reply:+|${(~j:|:)"${reply[@]#
|
|||
reply=( "${(Q)${(z@)reply[1]}[@]}" )
|
||||
(( ${+functions[${reply[5]}]} )) && \
|
||||
{ "${reply[5]}" "$@"; return $?; } || \
|
||||
{ print -r -- "(Couldn't find the subcommand-handler \`${reply[5]}' of the z-annex \`${reply[3]}')"; return 1; }
|
||||
{ +zinit-message "([error]Couldn't find the subcommand-handler \`[obj]${reply[5]}[error]' of the z-annex \`[file]${reply[3]}[error]')"; return 1; }
|
||||
}
|
||||
(( ${+functions[.zinit-confirm]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-autoload.zsh"
|
||||
case "$1" in
|
||||
|
|
@ -2395,7 +2461,7 @@ env-whitelist|bindkeys|module|add-fpath|fpath|run${reply:+|${(~j:|:)"${reply[@]#
|
|||
shift
|
||||
.zinit-recently "$@"; retval=$?
|
||||
;;
|
||||
(-h|--help|help|"")
|
||||
(-h|--help|help)
|
||||
.zinit-help
|
||||
;;
|
||||
(ls)
|
||||
|
|
@ -2417,7 +2483,8 @@ env-whitelist|bindkeys|module|add-fpath|fpath|run${reply:+|${(~j:|:)"${reply[@]#
|
|||
.zinit-module "${@[2-correct,-1]}"; retval=$?
|
||||
;;
|
||||
(*)
|
||||
print "Unknown command \`$1' (use \`help' to get usage information)"
|
||||
+zinit-message "[error]Unknown command ${__q}[obj]${1}[error]'" \
|
||||
"(use ${__q}[obj]help[error]' to get usage information).[rst]"
|
||||
retval=1
|
||||
;;
|
||||
esac
|
||||
|
|
@ -2505,9 +2572,8 @@ if [[ -e ${${ZINIT[BIN_DIR]}}/zmodules/Src/zdharma/zplugin.so ]] {
|
|||
[[ -e ${${ZINIT[BIN_DIR]}}/module/RECOMPILE_REQUEST ]] && local recompile_request_ts="$(<${${ZINIT[BIN_DIR]}}/module/RECOMPILE_REQUEST)"
|
||||
|
||||
if [[ ${recompile_request_ts:-1} -gt ${compiled_at_ts:-0} ]] {
|
||||
builtin print -r -- "${ZINIT[col-error]}WARNING:${ZINIT[col-rst]}" \
|
||||
"${ZINIT[col-msg1]}A ${ZINIT[col-obj]}recompilation${ZINIT[col-rst]}" \
|
||||
"of the Zinit module has been requested… ${ZINIT[col-obj]}Building${ZINIT[col-rst]}…"
|
||||
builtin print -r -- "[error]WARNING:[rst][msg1]A [obj]recompilation[rst]" \
|
||||
"of the Zinit module has been requested… [obj]Building[rst]…"
|
||||
(( ${+functions[.zinit-confirm]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-autoload.zsh"
|
||||
command make -C "${ZINIT[BIN_DIR]}/zmodules" distclean &>/dev/null
|
||||
.zinit-module build &>/dev/null
|
||||
|
|
|
|||
Loading…
Reference in a new issue