mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 07:36:38 -04:00
style: fix fold markers, typos, and comments
- Fix function typos in asciidoc comments - Fix asciidoc fold markers - Fix function args typos/style in asciidoc comments Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
This commit is contained in:
parent
bc56e757db
commit
62c07b7326
|
|
@ -30,8 +30,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
builtin eval "$___data"
|
builtin eval "$___data"
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-service [[[
|
# FUNCTION: .zinit-service [[[
|
||||||
# Handles given service, i.e. obtains lock, runs it, or waits if no lock
|
# Handles given service, i.e. obtains lock, runs it, or waits if no lock
|
||||||
#
|
#
|
||||||
|
|
@ -76,8 +75,8 @@
|
||||||
) || break
|
) || break
|
||||||
builtin read -t 1 ___tmp <>"${___fle:r}.fifo2"
|
builtin read -t 1 ___tmp <>"${___fle:r}.fifo2"
|
||||||
done >>! "$ZSRV_WORK_DIR/$ZSRV_ID".log 2>&1
|
done >>! "$ZSRV_WORK_DIR/$ZSRV_ID".log 2>&1
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-wrap-track-functions [[[
|
# FUNCTION: .zinit-wrap-track-functions [[[
|
||||||
.zinit-wrap-track-functions() {
|
.zinit-wrap-track-functions() {
|
||||||
local user="$1" plugin="$2" id_as="$3" f
|
local user="$1" plugin="$2" id_as="$3" f
|
||||||
|
|
@ -99,8 +98,7 @@ function $f {
|
||||||
ZINIT[CUR_USR]= ZINIT[CUR_PLUGIN]= ZINIT[CUR_USPL2]=
|
ZINIT[CUR_USR]= ZINIT[CUR_PLUGIN]= ZINIT[CUR_USPL2]=
|
||||||
}"
|
}"
|
||||||
done
|
done
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Dtrace
|
# Dtrace
|
||||||
|
|
@ -122,7 +120,7 @@ function $f {
|
||||||
.zinit-tmp-subst-on dtrace
|
.zinit-tmp-subst-on dtrace
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-debug-stop [[[
|
# FUNCTION: .zinit-debug-stop [[[
|
||||||
# Stops Dtrace, i.e. session tracking for changes in Zsh state.
|
# Stops Dtrace (i.e., session tracking for changes in Zsh state).
|
||||||
.zinit-debug-stop() {
|
.zinit-debug-stop() {
|
||||||
ZINIT[DTRACE]=0
|
ZINIT[DTRACE]=0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -700,13 +700,10 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
}
|
}
|
||||||
(( $? )) && cat
|
(( $? )) && cat
|
||||||
return 0
|
return 0
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
|
|
||||||
# FUNCTION: .zinit-self-update [[[
|
# FUNCTION: .zinit-self-update [[[
|
||||||
# Updates Zinit code (does a git pull).
|
# Updates Zinit code (does a git pull)
|
||||||
#
|
|
||||||
# User-action entry point.
|
|
||||||
.zinit-self-update() {
|
.zinit-self-update() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
setopt extendedglob typesetsilent warncreateglobal
|
setopt extendedglob typesetsilent warncreateglobal
|
||||||
|
|
@ -763,9 +760,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
}
|
}
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-show-registered-plugins [[[
|
# FUNCTION: .zinit-show-registered-plugins [[[
|
||||||
# Lists loaded plugins (subcommands list, lodaded).
|
# Lists loaded plugins (subcommands list, lodaded)
|
||||||
#
|
|
||||||
# User-action entry point.
|
|
||||||
.zinit-show-registered-plugins() {
|
.zinit-show-registered-plugins() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
setopt extendedglob warncreateglobal typesetsilent noshortloops
|
setopt extendedglob warncreateglobal typesetsilent noshortloops
|
||||||
|
|
@ -792,19 +787,17 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
done
|
done
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-unload [[[
|
# FUNCTION: .zinit-unload [[[
|
||||||
# 0. Call the Zsh Plugin's Standard *_plugin_unload function
|
# 1. call the zsh plugin's standard *_plugin_unload function
|
||||||
# 0. Call the code provided by the Zsh Plugin's Standard @zsh-plugin-run-at-update
|
# 2. call the code provided by the zsh plugin's standard @zsh-plugin-run-at-update
|
||||||
# 1. Delete bindkeys (...)
|
# 3. delete bindkeys (...)
|
||||||
# 2. Delete Zstyles
|
# 4. delete zstyles
|
||||||
# 3. Restore options
|
# 5. restore options
|
||||||
# 4. Remove aliases
|
# 6. remove aliases
|
||||||
# 5. Restore Zle state
|
# 7. restore zle state
|
||||||
# 6. Unfunction functions (created by plugin)
|
# 8. unfunction functions (created by plugin)
|
||||||
# 7. Clean-up FPATH and PATH
|
# 9. clean-up fpath and path
|
||||||
# 8. Delete created variables
|
# 10. delete created variables
|
||||||
# 9. Forget the plugin
|
# 11. forget the plugin
|
||||||
#
|
|
||||||
# User-action entry point.
|
|
||||||
#
|
#
|
||||||
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
||||||
# $2 - plugin (only when $1 - i.e. user - given)
|
# $2 - plugin (only when $1 - i.e. user - given)
|
||||||
|
|
@ -835,16 +828,10 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
typeset -g LASTREPORT
|
typeset -g LASTREPORT
|
||||||
LASTREPORT=`.zinit-show-report "$1" "$2"`
|
LASTREPORT=`.zinit-show-report "$1" "$2"`
|
||||||
|
|
||||||
#
|
|
||||||
# Call the Zsh Plugin's Standard *_plugin_unload function
|
# Call the Zsh Plugin's Standard *_plugin_unload function
|
||||||
#
|
|
||||||
|
|
||||||
(( ${+functions[${plugin}_plugin_unload]} )) && ${plugin}_plugin_unload
|
(( ${+functions[${plugin}_plugin_unload]} )) && ${plugin}_plugin_unload
|
||||||
|
|
||||||
#
|
|
||||||
# Call the code provided by the Zsh Plugin's Standard @zsh-plugin-run-at-update
|
# Call the code provided by the Zsh Plugin's Standard @zsh-plugin-run-at-update
|
||||||
#
|
|
||||||
|
|
||||||
local -a tmp
|
local -a tmp
|
||||||
local -A sice
|
local -A sice
|
||||||
tmp=( "${(z@)ZINIT_SICE[$uspl2]}" )
|
tmp=( "${(z@)ZINIT_SICE[$uspl2]}" )
|
||||||
|
|
@ -858,10 +845,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
() { setopt localoptions noautopushd; builtin cd -q "$___oldcd"; }
|
() { setopt localoptions noautopushd; builtin cd -q "$___oldcd"; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
|
||||||
# 1. Delete done bindkeys
|
# 1. Delete done bindkeys
|
||||||
#
|
|
||||||
|
|
||||||
typeset -a string_widget
|
typeset -a string_widget
|
||||||
string_widget=( "${(z)ZINIT[BINDKEYS__$uspl2]}" )
|
string_widget=( "${(z)ZINIT[BINDKEYS__$uspl2]}" )
|
||||||
local sw
|
local sw
|
||||||
|
|
@ -927,9 +911,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
#
|
|
||||||
# 2. Delete created Zstyles
|
# 2. Delete created Zstyles
|
||||||
#
|
|
||||||
|
|
||||||
typeset -a pattern_style
|
typeset -a pattern_style
|
||||||
pattern_style=( "${(z)ZINIT[ZSTYLES__$uspl2]}" )
|
pattern_style=( "${(z)ZINIT[ZSTYLES__$uspl2]}" )
|
||||||
|
|
@ -950,11 +932,8 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
zstyle -d "$ps_arr1" "$ps_arr2"
|
zstyle -d "$ps_arr1" "$ps_arr2"
|
||||||
done
|
done
|
||||||
|
|
||||||
#
|
|
||||||
# 3. Restore changed options
|
# 3. Restore changed options
|
||||||
#
|
# paranoid, don't want bad key/value pair error
|
||||||
|
|
||||||
# Paranoid, don't want bad key/value pair error
|
|
||||||
.zinit-diff-options-compute "$uspl2"
|
.zinit-diff-options-compute "$uspl2"
|
||||||
integer empty=0
|
integer empty=0
|
||||||
.zinit-save-set-extendedglob
|
.zinit-save-set-extendedglob
|
||||||
|
|
@ -978,10 +957,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
|
||||||
# 4. Delete aliases
|
# 4. Delete aliases
|
||||||
#
|
|
||||||
|
|
||||||
typeset -a aname_avalue
|
typeset -a aname_avalue
|
||||||
aname_avalue=( "${(z)ZINIT[ALIASES__$uspl2]}" )
|
aname_avalue=( "${(z)ZINIT[ALIASES__$uspl2]}" )
|
||||||
local nv
|
local nv
|
||||||
|
|
@ -1075,10 +1051,11 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
if (( found_idx || found_idx2 ))
|
if (( found_idx || found_idx2 ))
|
||||||
then
|
then
|
||||||
# Skip multiple loads of the same plugin
|
# Skip multiple loads of the same plugin
|
||||||
# TODO: Fully handle multiple plugin loads
|
# TODO: fully handle multiple plugin loads
|
||||||
if [[ "$oth_uspl2" != "$uspl2" ]]; then
|
if [[ "$oth_uspl2" != "$uspl2" ]]; then
|
||||||
to_process_plugin="$oth_uspl2"
|
to_process_plugin="$oth_uspl2"
|
||||||
break # Only the first one is needed
|
# only the first one is needed
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -1092,9 +1069,8 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
if (( found_idx )) {
|
if (( found_idx )) {
|
||||||
oth_orig_saved=( "${(z)${(Q)entry_splitted[found_idx]}}" )
|
oth_orig_saved=( "${(z)${(Q)entry_splitted[found_idx]}}" )
|
||||||
local oth_fun="${oth_orig_saved[4]}"
|
local oth_fun="${oth_orig_saved[4]}"
|
||||||
# oth_orig_saved[2]="${(q)orig_saved2}" # not do this, because
|
# below is wrong because we don't want to call other plugins function at any moment
|
||||||
# we don't want to call other
|
# oth_orig_saved[2]="${(q)orig_saved2}"
|
||||||
# plugin's function at any moment
|
|
||||||
oth_orig_saved[5]="${(q)orig_saved3}" # chain up the widget
|
oth_orig_saved[5]="${(q)orig_saved3}" # chain up the widget
|
||||||
entry_splitted[found_idx]="${(q)${(j: :)oth_orig_saved}}"
|
entry_splitted[found_idx]="${(q)${(j: :)oth_orig_saved}}"
|
||||||
ZINIT[WIDGETS_SAVED__$oth_uspl2]="${(j: :)entry_splitted}"
|
ZINIT[WIDGETS_SAVED__$oth_uspl2]="${(j: :)entry_splitted}"
|
||||||
|
|
@ -1123,10 +1099,9 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
zle -N "$oth_prefix_uspl2_X" "${widgets[$prefix_X]#user:}"
|
zle -N "$oth_prefix_uspl2_X" "${widgets[$prefix_X]#user:}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The alternate method
|
# The alternate method
|
||||||
#skip_delete+=( "${match[1]}" )
|
# skip_delete+=( "${match[1]}" )
|
||||||
#functions[$oth_fun]="${functions[$oth_fun]//[^\{[:space:]]#$orig_saved1/${match[1]}}"
|
# functions[$oth_fun]="${functions[$oth_fun]//[^\{[:space:]]#$orig_saved1/${match[1]}}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
(( quiet )) || builtin print "Restoring Zle widget $orig_saved1"
|
(( quiet )) || builtin print "Restoring Zle widget $orig_saved1"
|
||||||
|
|
@ -1162,10 +1137,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
zle -D "$wid"
|
zle -D "$wid"
|
||||||
done
|
done
|
||||||
|
|
||||||
#
|
|
||||||
# 6. Unfunction
|
# 6. Unfunction
|
||||||
#
|
|
||||||
|
|
||||||
.zinit-diff-functions-compute "$uspl2"
|
.zinit-diff-functions-compute "$uspl2"
|
||||||
typeset -a func
|
typeset -a func
|
||||||
func=( "${(z)ZINIT[FUNCTIONS__$uspl2]}" )
|
func=( "${(z)ZINIT[FUNCTIONS__$uspl2]}" )
|
||||||
|
|
@ -1183,14 +1155,9 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
(( ${+zshexit_functions} )) && zshexit_functions=( ${zshexit_functions[@]:#$f} )
|
(( ${+zshexit_functions} )) && zshexit_functions=( ${zshexit_functions[@]:#$f} )
|
||||||
done
|
done
|
||||||
|
|
||||||
#
|
|
||||||
# 7. Clean up FPATH and PATH
|
# 7. Clean up FPATH and PATH
|
||||||
#
|
|
||||||
|
|
||||||
.zinit-diff-env-compute "$uspl2"
|
.zinit-diff-env-compute "$uspl2"
|
||||||
|
# iterate over $path elements and skip those that were added by the plugin
|
||||||
# Have to iterate over $path elements and
|
|
||||||
# skip those that were added by the plugin
|
|
||||||
typeset -a new elem p
|
typeset -a new elem p
|
||||||
elem=( "${(z)ZINIT[PATH__$uspl2]}" )
|
elem=( "${(z)ZINIT[PATH__$uspl2]}" )
|
||||||
for p in "${path[@]}"; do
|
for p in "${path[@]}"; do
|
||||||
|
|
@ -1216,10 +1183,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
}
|
}
|
||||||
fpath=( "${new[@]}" )
|
fpath=( "${new[@]}" )
|
||||||
|
|
||||||
#
|
|
||||||
# 8. Delete created variables
|
# 8. Delete created variables
|
||||||
#
|
|
||||||
|
|
||||||
.zinit-diff-parameter-compute "$uspl2"
|
.zinit-diff-parameter-compute "$uspl2"
|
||||||
empty=0
|
empty=0
|
||||||
.zinit-save-set-extendedglob
|
.zinit-save-set-extendedglob
|
||||||
|
|
@ -1245,8 +1209,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
# Don't unset readonly variables
|
# Don't unset readonly variables
|
||||||
[[ ${(tP)k} == *-readonly(|-*) ]] && continue
|
[[ ${(tP)k} == *-readonly(|-*) ]] && continue
|
||||||
|
|
||||||
# Don't unset arrays managed by add-zsh-hook,
|
# Don't unset arrays managed by add-zsh-hook, also ignore a few special parameters
|
||||||
# also ignore a few special parameters
|
|
||||||
# TODO: remember and remove hooks
|
# TODO: remember and remove hooks
|
||||||
case "$k" in
|
case "$k" in
|
||||||
(chpwd_functions|precmd_functions|preexec_functions|periodic_functions|zshaddhistory_functions|zshexit_functions|zsh_directory_name_functions)
|
(chpwd_functions|precmd_functions|preexec_functions|periodic_functions|zshaddhistory_functions|zshexit_functions|zsh_directory_name_functions)
|
||||||
|
|
@ -1256,10 +1219,8 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Don't unset redefined variables, only newly defined
|
# Don't unset redefined variables, only newly defined "" means variable didn't exist before plugin load (didn't have a type).
|
||||||
# "" means variable didn't exist before plugin load
|
# Do an exception for the prompt variables
|
||||||
# (didn't have a type).
|
|
||||||
# Do an exception for the prompt variables.
|
|
||||||
if [[ $v1 = '""' || ( $k = (RPROMPT|RPS1|RPS2|PROMPT|PS1|PS2|PS3|PS4) && $v1 != $v2 ) ]]; then
|
if [[ $v1 = '""' || ( $k = (RPROMPT|RPS1|RPS2|PROMPT|PS1|PS2|PS3|PS4) && $v1 != $v2 ) ]]; then
|
||||||
found=0
|
found=0
|
||||||
for wl in "${whitelist[@]}"; do
|
for wl in "${whitelist[@]}"; do
|
||||||
|
|
@ -1270,9 +1231,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
done
|
done
|
||||||
if (( !found )); then
|
if (( !found )); then
|
||||||
(( quiet )) || builtin print "Unsetting variable $k"
|
(( quiet )) || builtin print "Unsetting variable $k"
|
||||||
# Checked that 4.3.17 does support "--"
|
# checked that 4.3.17 does support "--"; cannot be parameter starting with "-" but let's defensively use "--" here
|
||||||
# There cannot be parameter starting with
|
|
||||||
# "-" but let's defensively use "--" here
|
|
||||||
unset -- "$k"
|
unset -- "$k"
|
||||||
else
|
else
|
||||||
builtin print "Skipping unset of variable $k (whitelist)"
|
builtin print "Skipping unset of variable $k (whitelist)"
|
||||||
|
|
@ -1282,10 +1241,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
|
||||||
# 9. Forget the plugin
|
# 9. Forget the plugin
|
||||||
#
|
|
||||||
|
|
||||||
if [[ "$uspl2" = "_dtrace/_dtrace" ]]; then
|
if [[ "$uspl2" = "_dtrace/_dtrace" ]]; then
|
||||||
.zinit-clear-debug-report
|
.zinit-clear-debug-report
|
||||||
(( quiet )) || builtin print "dtrace report saved to \$LASTREPORT"
|
(( quiet )) || builtin print "dtrace report saved to \$LASTREPORT"
|
||||||
|
|
@ -1296,13 +1252,10 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
.zinit-clear-report-for "$user" "$plugin"
|
.zinit-clear-report-for "$user" "$plugin"
|
||||||
(( quiet )) || builtin print "Plugin's report saved to \$LASTREPORT"
|
(( quiet )) || builtin print "Plugin's report saved to \$LASTREPORT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-show-report [[[
|
# FUNCTION: .zinit-show-report [[[
|
||||||
# Displays report of the plugin given.
|
# Displays report of the plugin given.
|
||||||
#
|
#
|
||||||
# User-action entry point.
|
|
||||||
#
|
|
||||||
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user (+ plugin in $2), plugin)
|
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user (+ plugin in $2), plugin)
|
||||||
# $2 - plugin (only when $1 - i.e. user - given)
|
# $2 - plugin (only when $1 - i.e. user - given)
|
||||||
.zinit-show-report() {
|
.zinit-show-report() {
|
||||||
|
|
@ -1823,8 +1776,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
}
|
}
|
||||||
|
|
||||||
return $retval
|
return $retval
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-update-or-status-all [[[
|
# FUNCTION: .zinit-update-or-status-all [[[
|
||||||
# Updates (git pull) or does `git status` for all existing plugins.
|
# Updates (git pull) or does `git status` for all existing plugins.
|
||||||
# This includes also plugins that are not loaded into Zsh (but exist
|
# This includes also plugins that are not loaded into Zsh (but exist
|
||||||
|
|
@ -1974,7 +1926,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
|
|
||||||
return "$retval"
|
return "$retval"
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-update-in-parallel [[[
|
# FUNCTION: .zinit-update-all-parallel [[[
|
||||||
.zinit-update-all-parallel() {
|
.zinit-update-all-parallel() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
setopt extendedglob warncreateglobal typesetsilent \
|
setopt extendedglob warncreateglobal typesetsilent \
|
||||||
|
|
@ -1992,8 +1944,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
if (( OPTS[opt_-s,--snippets] || !OPTS[opt_-l,--plugins] )) {
|
if (( OPTS[opt_-s,--snippets] || !OPTS[opt_-l,--plugins] )) {
|
||||||
for snip ( "${files[@]}" ) {
|
for snip ( "${files[@]}" ) {
|
||||||
main_counter=main_counter-1
|
main_counter=main_counter-1
|
||||||
# The continue may cause the tail of processes to
|
# The continue may cause the tail of processes to fall-through to the following plugins-specific `wait'
|
||||||
# fall-through to the following plugins-specific `wait'
|
|
||||||
# Should happen only in a very special conditions
|
# Should happen only in a very special conditions
|
||||||
# TODO handle this
|
# TODO handle this
|
||||||
[[ ! -f ${snip:h}/url ]] && continue
|
[[ ! -f ${snip:h}/url ]] && continue
|
||||||
|
|
@ -2073,8 +2024,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
}
|
}
|
||||||
# Shouldn't happen
|
# Shouldn't happen
|
||||||
# (( ${#PUAssocArray} > 0 )) && wait ${(k)PUAssocArray}
|
# (( ${#PUAssocArray} > 0 )) && wait ${(k)PUAssocArray}
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-wait-for-update-jobs [[[
|
# FUNCTION: .zinit-wait-for-update-jobs [[[
|
||||||
.zinit-wait-for-update-jobs() {
|
.zinit-wait-for-update-jobs() {
|
||||||
local tpe=$1
|
local tpe=$1
|
||||||
|
|
@ -2095,8 +2045,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
"${OPTS[value]}{obj} concurrent update jobs" \
|
"${OPTS[value]}{obj} concurrent update jobs" \
|
||||||
"({msg2}${tpe}{obj}){…}{rst}"
|
"({msg2}${tpe}{obj}){…}{rst}"
|
||||||
}
|
}
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-show-zstatus [[[
|
# FUNCTION: .zinit-show-zstatus [[[
|
||||||
# Shows Zinit status, i.e. number of loaded plugins,
|
# Shows Zinit status, i.e. number of loaded plugins,
|
||||||
# of available completions, etc.
|
# of available completions, etc.
|
||||||
|
|
@ -2239,8 +2188,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
(( sum += ZINIT[$entry] ))
|
(( sum += ZINIT[$entry] ))
|
||||||
done
|
done
|
||||||
builtin print "Total: $sum sec"
|
builtin print "Total: $sum sec"
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-list-bindkeys [[[
|
# FUNCTION: .zinit-list-bindkeys [[[
|
||||||
.zinit-list-bindkeys() {
|
.zinit-list-bindkeys() {
|
||||||
local uspl2 uspl2col sw first=1
|
local uspl2 uspl2col sw first=1
|
||||||
|
|
@ -2292,9 +2240,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
|
|
||||||
# FUNCTION: .zinit-compiled [[[
|
# FUNCTION: .zinit-compiled [[[
|
||||||
# Displays list of plugins that are compiled.
|
# Displays list of plugins that are compiled.
|
||||||
#
|
#
|
||||||
|
|
@ -2698,7 +2644,6 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-cd [[[
|
# FUNCTION: .zinit-cd [[[
|
||||||
# Jumps to plugin's directory (in Zinit's home directory).
|
# Jumps to plugin's directory (in Zinit's home directory).
|
||||||
#
|
#
|
||||||
|
|
@ -2744,8 +2689,7 @@ ZINIT[EXTENDED_GLOB]=""
|
||||||
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
|
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
|
||||||
"${arr[5]}" "$1" "$2" $3 "$4" "$5" "${${key##(zinit|z-annex) hook:}%% <->}" delete:TODO
|
"${arr[5]}" "$1" "$2" $3 "$4" "$5" "${${key##(zinit|z-annex) hook:}%% <->}" delete:TODO
|
||||||
done
|
done
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-delete [[[
|
# FUNCTION: .zinit-delete [[[
|
||||||
# Deletes plugin's or snippet's directory (in Zinit's home directory).
|
# Deletes plugin's or snippet's directory (in Zinit's home directory).
|
||||||
#
|
#
|
||||||
|
|
@ -2907,8 +2851,7 @@ builtin print -Pr \"\$ZINIT[col-obj]Done (with the exit code: \$_retval).%f%b\""
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-changes [[[
|
# FUNCTION: .zinit-changes [[[
|
||||||
# Shows `git log` of given plugin.
|
# Shows `git log` of given plugin.
|
||||||
#
|
#
|
||||||
|
|
@ -3269,8 +3212,7 @@ EOF
|
||||||
list[-1]+=", located at ZINIT[SNIPPETS_DIR], i.e. ${ZINIT[SNIPPETS_DIR]}"
|
list[-1]+=", located at ZINIT[SNIPPETS_DIR], i.e. ${ZINIT[SNIPPETS_DIR]}"
|
||||||
builtin print -rl -- "${list[@]}"
|
builtin print -rl -- "${list[@]}"
|
||||||
)
|
)
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-get-path [[[
|
# FUNCTION: .zinit-get-path [[[
|
||||||
# Returns path of given ID-string, which may be a plugin-spec
|
# Returns path of given ID-string, which may be a plugin-spec
|
||||||
# (like "user/plugin" or "user" "plugin"), an absolute path
|
# (like "user/plugin" or "user" "plugin"), an absolute path
|
||||||
|
|
@ -3285,8 +3227,7 @@ EOF
|
||||||
.zinit-get-object-path plugin "$id_as"
|
.zinit-get-object-path plugin "$id_as"
|
||||||
|
|
||||||
return $(( 1 - reply[3] ))
|
return $(( 1 - reply[3] ))
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-recall [[[
|
# FUNCTION: .zinit-recall [[[
|
||||||
.zinit-recall() {
|
.zinit-recall() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
|
|
@ -3335,8 +3276,7 @@ EOF
|
||||||
fi
|
fi
|
||||||
+zinit-deploy-message @rst
|
+zinit-deploy-message @rst
|
||||||
} || builtin print -r -- "No such plugin or snippet"
|
} || builtin print -r -- "No such plugin or snippet"
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-module [[[
|
# FUNCTION: .zinit-module [[[
|
||||||
# Function that has sub-commands passed as long-options (with two dashes, --).
|
# Function that has sub-commands passed as long-options (with two dashes, --).
|
||||||
# It's an attempt to plugin only this one function into `zinit' function
|
# It's an attempt to plugin only this one function into `zinit' function
|
||||||
|
|
@ -3366,8 +3306,7 @@ EOF
|
||||||
builtin print -r "to be run. To display the instructions on loading the module, run:"
|
builtin print -r "to be run. To display the instructions on loading the module, run:"
|
||||||
builtin print -r "\`zinit module info'."
|
builtin print -r "\`zinit module info'."
|
||||||
fi
|
fi
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
# FUNCTION: .zinit-build-module [[[
|
# FUNCTION: .zinit-build-module [[[
|
||||||
# Performs ./configure && make on the module and displays information
|
# Performs ./configure && make on the module and displays information
|
||||||
# how to load the module in .zshrc.
|
# how to load the module in .zshrc.
|
||||||
|
|
@ -3411,8 +3350,7 @@ EOF
|
||||||
}
|
}
|
||||||
builtin print $EPOCHSECONDS >! "${ZINIT[MAN_DIR]}/COMPILED_AT"
|
builtin print $EPOCHSECONDS >! "${ZINIT[MAN_DIR]}/COMPILED_AT"
|
||||||
)
|
)
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Help function
|
# Help function
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-json-get-value [[[
|
# FUNCTION: .zinit-json-get-value [[[
|
||||||
# Wrapper around jq that return the value of a property
|
# Wrapper around jq that return the value of a property
|
||||||
|
#
|
||||||
# $1: JSON structure
|
# $1: JSON structure
|
||||||
# $2: jq path
|
# $2: jq path
|
||||||
.zinit-json-get-value() {
|
.zinit-json-get-value() {
|
||||||
|
|
@ -33,6 +34,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
||||||
# FUNCTION: .zinit-json-to-array [[[
|
# FUNCTION: .zinit-json-to-array [[[
|
||||||
# Wrapper around jq that sets key/values of an associative array, replicating
|
# Wrapper around jq that sets key/values of an associative array, replicating
|
||||||
# the structure of a given JSON object
|
# the structure of a given JSON object
|
||||||
|
#
|
||||||
# $1: JSON structure
|
# $1: JSON structure
|
||||||
# $2: jq path
|
# $2: jq path
|
||||||
# $3: name of the associative array to store the key/value pairs in
|
# $3: name of the associative array to store the key/value pairs in
|
||||||
|
|
@ -68,8 +70,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
||||||
pkgjson tmpfile=${$(mktemp):-${TMPDIR:-/tmp}/zsh.xYzAbc123}
|
pkgjson tmpfile=${$(mktemp):-${TMPDIR:-/tmp}/zsh.xYzAbc123}
|
||||||
local URL=https://raw.githubusercontent.com/${ZINIT[PACKAGES_REPO]}/${ver:-${ZINIT[PACKAGES_BRANCH]}}/${pkg}/package.json
|
local URL=https://raw.githubusercontent.com/${ZINIT[PACKAGES_REPO]}/${ver:-${ZINIT[PACKAGES_BRANCH]}}/${pkg}/package.json
|
||||||
|
|
||||||
# Consume, ie delete the ver ice to avoid being consumed again at
|
# Consume (i.e., delete) the ver ice to avoid being consumed again at git-clone time
|
||||||
# git-clone time
|
|
||||||
[[ -n "$ver" ]] && unset 'ICE[ver]'
|
[[ -n "$ver" ]] && unset 'ICE[ver]'
|
||||||
|
|
||||||
local pro_sep="{rst}, {profile}" epro_sep="{error}, {profile}" \
|
local pro_sep="{rst}, {profile}" epro_sep="{error}, {profile}" \
|
||||||
|
|
@ -523,13 +524,13 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-install-completions [[[
|
# FUNCTION: .zinit-install-completions [[[
|
||||||
# Installs all completions of given plugin. After that they are
|
# Installs all completions of given plugin. After that they are
|
||||||
# visible to `compinit'. Visible completions can be selectively
|
# visible to 'compinit'. Visible completions can be selectively
|
||||||
# disabled and enabled. User can access completion data with
|
# disabled and enabled. User can access completion data with
|
||||||
# `clist' or `completions' subcommand.
|
# 'clist' or 'completions' subcommand.
|
||||||
#
|
#
|
||||||
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
||||||
# $2 - plugin (only when $1 - i.e. user - given)
|
# $2 - plugin if $1 (i.e., user) given
|
||||||
# $3 - if 1, then reinstall, otherwise only install completions that aren't there
|
# $3 - if 1, then reinstall, otherwise only install completions that are not present
|
||||||
.zinit-install-completions() {
|
.zinit-install-completions() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
setopt nullglob extendedglob warncreateglobal typesetsilent noshortloops
|
setopt nullglob extendedglob warncreateglobal typesetsilent noshortloops
|
||||||
|
|
@ -549,10 +550,10 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
||||||
|
|
||||||
.zinit-exists-physically-message "$id_as" "" || return 1
|
.zinit-exists-physically-message "$id_as" "" || return 1
|
||||||
|
|
||||||
# Symlink any completion files included in plugin's directory
|
# Symlink any completion files included in the plugin directory
|
||||||
typeset -a completions already_symlinked backup_comps
|
typeset -a completions already_symlinked backup_comps
|
||||||
local c cfile bkpfile
|
local c cfile bkpfile
|
||||||
# The plugin == . is a semi-hack/trick to handle `creinstall .' properly
|
# The plugin == . is a semi-hack/trick to handle 'creinstall .' properly
|
||||||
[[ $user == % || ( -z $user && $plugin == . ) ]] && \
|
[[ $user == % || ( -z $user && $plugin == . ) ]] && \
|
||||||
completions=( "${plugin}"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|*.yml|*.ri|_zsh_highlight*|/zsdoc/*|*.ps1)(DN^/) ) || \
|
completions=( "${plugin}"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|*.yml|*.ri|_zsh_highlight*|/zsdoc/*|*.ps1)(DN^/) ) || \
|
||||||
completions=( "${ZINIT[PLUGINS_DIR]}/${id_as//\//---}"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|*.yml|*.ri|_zsh_highlight*|/zsdoc/*|*.ps1)(DN^/) )
|
completions=( "${ZINIT[PLUGINS_DIR]}/${id_as//\//---}"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|*.yml|*.ri|_zsh_highlight*|/zsdoc/*|*.ps1)(DN^/) )
|
||||||
|
|
@ -561,7 +562,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
||||||
|
|
||||||
# Symlink completions if they are not already there
|
# Symlink completions if they are not already there
|
||||||
# either as completions (_fname) or as backups (fname)
|
# either as completions (_fname) or as backups (fname)
|
||||||
# OR - if it's a reinstall
|
# OR - if its a reinstall
|
||||||
for c in "${completions[@]}"; do
|
for c in "${completions[@]}"; do
|
||||||
cfile="${c:t}"
|
cfile="${c:t}"
|
||||||
bkpfile="${cfile#_}"
|
bkpfile="${cfile#_}"
|
||||||
|
|
@ -670,7 +671,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
||||||
|
|
||||||
if (( ${+commands[curl]} )); then
|
if (( ${+commands[curl]} )); then
|
||||||
if [[ -n $progress ]]; then
|
if [[ -n $progress ]]; then
|
||||||
command curl --progress-bar -fSL "$url" 2> >($ZINIT[BIN_DIR]/share/single-line.zsh >&2) || return 1
|
command curl --progress-bar -fSL "$url" 2> >(.zinit-single-line >&2) || return 1
|
||||||
else
|
else
|
||||||
command curl -fsSL "$url" || return 1
|
command curl -fsSL "$url" || return 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -689,7 +690,7 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
||||||
} else {
|
} else {
|
||||||
if type curl 2>/dev/null 1>&2; then
|
if type curl 2>/dev/null 1>&2; then
|
||||||
if [[ -n $progress ]]; then
|
if [[ -n $progress ]]; then
|
||||||
command curl --progress-bar -fSL "$url" 2> >($ZINIT[BIN_DIR]/share/single-line.zsh >&2) || return 1
|
command curl --progress-bar -fSL "$url" 2> >(.zinit-single-line >&2) || return 1
|
||||||
else
|
else
|
||||||
command curl -fsSL "$url" || return 1
|
command curl -fsSL "$url" || return 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -910,10 +911,12 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-download-snippet [[[
|
# FUNCTION: .zinit-download-snippet [[[
|
||||||
# Downloads snippet – either a file – with curl, wget, lftp or lynx,
|
# Downloads snippet
|
||||||
# or a directory, with Subversion – when svn-ICE is active. Github
|
# file – with curl, wget, lftp or lynx,
|
||||||
# supports Subversion protocol and allows to clone subdirectories.
|
# directory, with Subversion – when svn-ICE is active.
|
||||||
# This is used to provide a layer of support for Oh-My-Zsh and Prezto.
|
#
|
||||||
|
# Github supports Subversion protocol and allows to clone subdirectories.
|
||||||
|
# This is used to provide a layer of support for Oh-My-Zsh and Prezto.
|
||||||
.zinit-download-snippet() {
|
.zinit-download-snippet() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
setopt extendedglob warncreateglobal typesetsilent
|
setopt extendedglob warncreateglobal typesetsilent
|
||||||
|
|
@ -1451,6 +1454,32 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
|
||||||
|
|
||||||
return $?
|
return $?
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
# FUNCTION: .zinit-single-line [[[
|
||||||
|
# Display cURL progress bar on a single line
|
||||||
|
.zinit-single-line() {
|
||||||
|
emulate -LR zsh
|
||||||
|
setopt extendedglob noshortloops nowarncreateglobal rcquotes typesetsilent
|
||||||
|
local IFS= n=$'\n' r=$'\r' zero=$'\0'
|
||||||
|
|
||||||
|
{
|
||||||
|
command perl -pe 'BEGIN { $|++; $/ = \1 }; tr/\r\n/\n\0/' \
|
||||||
|
|| gstdbuf -o0 gtr '\r\n' '\n\0' \
|
||||||
|
|| stdbuf -o0 tr '\r\n' '\n\0';
|
||||||
|
print
|
||||||
|
} 2>/dev/null | while read -r line;
|
||||||
|
|
||||||
|
do
|
||||||
|
if [[ $line == *$zero* ]]; then
|
||||||
|
# cURL doesn't add a newline to progress bars
|
||||||
|
# print -nr -- "${r}${(l:COLUMNS:: :):-}${r}${line##*${zero}}"
|
||||||
|
print -nr -- "${r}${(l:COLUMNS:: :):-}${r}${line%${zero}}"
|
||||||
|
else
|
||||||
|
print -nr -- "${r}${(l:COLUMNS:: :):-}${r}${${line//[${r}${n}]/}%\%*}${${(M)line%\%}:+%}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
print
|
||||||
|
} # ]]]
|
||||||
# FUNCTION: .zinit-get-latest-gh-r-url-part [[[
|
# FUNCTION: .zinit-get-latest-gh-r-url-part [[[
|
||||||
# Gets version string of latest release of given Github
|
# Gets version string of latest release of given Github
|
||||||
# package. Connects to Github releases page.
|
# package. Connects to Github releases page.
|
||||||
|
|
@ -1944,8 +1973,9 @@ ziextract() {
|
||||||
)
|
)
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: zpextract [[[
|
# FUNCTION: zpextract [[[
|
||||||
zpextract() { ziextract "$@"; }
|
zpextract() {
|
||||||
# ]]]
|
ziextract "$@"
|
||||||
|
} # ]]]
|
||||||
# FUNCTION: .zinit-at-eval [[[
|
# FUNCTION: .zinit-at-eval [[[
|
||||||
.zinit-at-eval() {
|
.zinit-at-eval() {
|
||||||
local atpull="$1" atclone="$2"
|
local atpull="$1" atclone="$2"
|
||||||
|
|
@ -2075,17 +2105,16 @@ zicp() {
|
||||||
return $retval
|
return $retval
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
} # ]]]
|
||||||
|
# FUNCTION: zimv [[[
|
||||||
zimv() {
|
zimv() {
|
||||||
local dir
|
local dir
|
||||||
if [[ $1 = (-d|--dir) ]] { dir=$2; shift 2; }
|
if [[ $1 = (-d|--dir) ]] { dir=$2; shift 2; }
|
||||||
zicp --mv ${dir:+--dir} $dir "$@"
|
zicp --mv ${dir:+--dir} $dir "$@"
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-configure-run-autoconf [[[
|
# FUNCTION: .zinit-configure-run-autoconf [[[
|
||||||
# Called either because # flag given to configure'', or because
|
# Called either because "#" flag given to configure'', or because
|
||||||
# there's no ./configure script. Runs autoconf, autoreconf,
|
# theres no ./configure script. Runs autoconf, autoreconf, and autogen.sh as needed.
|
||||||
# autogen.sh as needed.
|
|
||||||
.zinit-configure-run-autoconf() {
|
.zinit-configure-run-autoconf() {
|
||||||
local dir=$1 flags=$2
|
local dir=$1 flags=$2
|
||||||
integer q
|
integer q
|
||||||
|
|
@ -2158,7 +2187,7 @@ ${${${(M)flags:#*\#*}:+$msg}:-$msg_}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: ∞zinit-reset-opt-hook [[[
|
# FUNCTION: ∞zinit-reset-hook [[[
|
||||||
∞zinit-reset-hook() {
|
∞zinit-reset-hook() {
|
||||||
# File
|
# File
|
||||||
if [[ "$1" = plugin ]] {
|
if [[ "$1" = plugin ]] {
|
||||||
|
|
@ -2359,7 +2388,7 @@ for its found {file}meson.build{pre} input file}:-because {flag}m{pre} \
|
||||||
∞zinit-make-hook() {
|
∞zinit-make-hook() {
|
||||||
∞zinit-make-base-hook "$@" ""
|
∞zinit-make-base-hook "$@" ""
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: ∞zinit-make-hook [[[
|
# FUNCTION: ∞zinit-make-base-hook [[[
|
||||||
∞zinit-make-base-hook() {
|
∞zinit-make-base-hook() {
|
||||||
[[ "$1" = plugin ]] && \
|
[[ "$1" = plugin ]] && \
|
||||||
local dir="${5#%}" hook="$6" subtype="$7" ex="$8" || \
|
local dir="${5#%}" hook="$6" subtype="$7" ex="$8" || \
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@
|
||||||
#
|
#
|
||||||
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
||||||
# $2 - plugin (only when $1 - i.e. user - given)
|
# $2 - plugin (only when $1 - i.e. user - given)
|
||||||
# $REPLY = ANSI-colorified "user/plugin" string
|
#
|
||||||
|
# $REPLY - ANSI-colorified "user/plugin" string
|
||||||
.zinit-any-colorify-as-uspl2() {
|
.zinit-any-colorify-as-uspl2() {
|
||||||
.zinit-any-to-user-plugin "$1" "$2"
|
.zinit-any-to-user-plugin "$1" "$2"
|
||||||
local user="${reply[-2]}" plugin="${reply[-1]}"
|
local user="${reply[-2]}" plugin="${reply[-1]}"
|
||||||
|
|
@ -78,7 +79,7 @@
|
||||||
|
|
||||||
# strip whitespace from beginning of url
|
# strip whitespace from beginning of url
|
||||||
___URL="${${___URL#"${___URL%%[! $'\t']*}"}%/}"
|
___URL="${${___URL#"${___URL%%[! $'\t']*}"}%/}"
|
||||||
|
|
||||||
# snippet
|
# snippet
|
||||||
.zinit-two-paths "$___URL"
|
.zinit-two-paths "$___URL"
|
||||||
local ___s_path="${reply[-4]}" ___s_svn="${reply[-3]}" ___path="${reply[-2]}" ___filename="${reply[-1]}" ___local_dir
|
local ___s_path="${reply[-4]}" ___s_svn="${reply[-3]}" ___path="${reply[-2]}" ___filename="${reply[-1]}" ___local_dir
|
||||||
|
|
@ -133,7 +134,6 @@
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local ___zinit_path="$___local_dir/._zinit"
|
local ___zinit_path="$___local_dir/._zinit"
|
||||||
|
|
||||||
# read disk-ice
|
# read disk-ice
|
||||||
local -A ___mdata
|
local -A ___mdata
|
||||||
local ___key
|
local ___key
|
||||||
|
|
@ -217,7 +217,6 @@
|
||||||
+zinit-message -r -- "{b}{error}0 <running now>{rst}{…}"
|
+zinit-message -r -- "{b}{error}0 <running now>{rst}{…}"
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-exists-physically [[[
|
# FUNCTION: .zinit-exists-physically [[[
|
||||||
# Checks if directory of given plugin exists in PLUGIN_DIR.
|
# Checks if directory of given plugin exists in PLUGIN_DIR.
|
||||||
#
|
#
|
||||||
|
|
@ -266,7 +265,6 @@
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-first [[[
|
# FUNCTION: .zinit-first [[[
|
||||||
# Finds the main file of plugin. There are multiple file name formats, they are
|
# Finds the main file of plugin. There are multiple file name formats, they are
|
||||||
# ordered in order starting from more correct ones, and matched.
|
# ordered in order starting from more correct ones, and matched.
|
||||||
|
|
@ -306,17 +304,17 @@
|
||||||
# FUNCTION: .zinit-store-ices [[[
|
# FUNCTION: .zinit-store-ices [[[
|
||||||
# Saves ice mods in given hash onto disk.
|
# Saves ice mods in given hash onto disk.
|
||||||
#
|
#
|
||||||
# $1 - directory where to create/delete files
|
# $1 - directory where to create or delete files
|
||||||
# $2 - name of hash that holds values
|
# $2 - name of hash that holds values
|
||||||
# $3 - additional keys of hash to store, space separated
|
# $3 - additional keys of hash to store, space separated
|
||||||
# $4 - additional keys of hash to store, empty-meaningful ices, space separated
|
# $4 - additional keys of hash to store, empty-meaningful ices, space separated
|
||||||
# $5 – the URL, if applicable
|
# $5 – URL, if applicable
|
||||||
# $6 – the mode 1 - svn, 0 - single file), if applicable
|
# $6 – mode, svn=1, 0=single file
|
||||||
.zinit-store-ices() {
|
.zinit-store-ices() {
|
||||||
local ___pfx="$1" ___ice_var="$2" ___add_ices="$3" ___add_ices2="$4"
|
local ___pfx="$1" ___ice_var="$2" ___add_ices="$3" ___add_ices2="$4"
|
||||||
local url="$5" mode="$6"
|
local url="$5" mode="$6"
|
||||||
|
|
||||||
# Copy from .zinit-recall
|
# Copy from zinit-recall response
|
||||||
local -a ice_order nval_ices
|
local -a ice_order nval_ices
|
||||||
ice_order=(
|
ice_order=(
|
||||||
${(s.|.)ZINIT[ice-list]}
|
${(s.|.)ZINIT[ice-list]}
|
||||||
|
|
@ -370,7 +368,7 @@
|
||||||
|
|
||||||
# remove leading whitespace and trailing /
|
# remove leading whitespace and trailing /
|
||||||
url="${${url#"${url%%[! $'\t']*}"}%/}"
|
url="${${url#"${url%%[! $'\t']*}"}%/}"
|
||||||
url1=$url
|
url1=$url
|
||||||
url2=$url
|
url2=$url
|
||||||
|
|
||||||
.zinit-get-object-path snippet "$url1"
|
.zinit-get-object-path snippet "$url1"
|
||||||
|
|
|
||||||
366
zinit.zsh
366
zinit.zsh
|
|
@ -121,10 +121,11 @@ builtin autoload -Uz is-at-least
|
||||||
is-at-least 5.1 && ZINIT[NEW_AUTOLOAD]=1 || ZINIT[NEW_AUTOLOAD]=0
|
is-at-least 5.1 && ZINIT[NEW_AUTOLOAD]=1 || ZINIT[NEW_AUTOLOAD]=0
|
||||||
#is-at-least 5.4 && ZINIT[NEW_AUTOLOAD]=2
|
#is-at-least 5.4 && ZINIT[NEW_AUTOLOAD]=2
|
||||||
|
|
||||||
# Parameters - temporary substituting of functions. [[[
|
# Parameters [[[
|
||||||
ZINIT[TMP_SUBST]=inactive ZINIT[DTRACE]=0 ZINIT[CUR_PLUGIN]=
|
# temporary substituting of functions
|
||||||
# ]]]
|
ZINIT[TMP_SUBST]=inactive ZINIT[DTRACE]=0 ZINIT[CUR_PLUGIN]=
|
||||||
# Parameters - ICE. [[[
|
|
||||||
|
# ice
|
||||||
declare -gA ZINIT_1MAP ZINIT_2MAP
|
declare -gA ZINIT_1MAP ZINIT_2MAP
|
||||||
ZINIT_1MAP=(
|
ZINIT_1MAP=(
|
||||||
OMZ:: https://github.com/ohmyzsh/ohmyzsh/trunk/
|
OMZ:: https://github.com/ohmyzsh/ohmyzsh/trunk/
|
||||||
|
|
@ -144,7 +145,7 @@ ZINIT_2MAP=(
|
||||||
)
|
)
|
||||||
# ]]]
|
# ]]]
|
||||||
|
|
||||||
# Init. [[[
|
# Init [[[
|
||||||
zmodload zsh/zutil || { builtin print -P "%F{196}zsh/zutil module is required, aborting Zinit set up.%f"; return 1; }
|
zmodload zsh/zutil || { builtin print -P "%F{196}zsh/zutil module is required, aborting Zinit set up.%f"; return 1; }
|
||||||
zmodload zsh/parameter || { builtin print -P "%F{196}zsh/parameter module is required, aborting Zinit set up.%f"; return 1; }
|
zmodload zsh/parameter || { builtin print -P "%F{196}zsh/parameter module is required, aborting Zinit set up.%f"; return 1; }
|
||||||
zmodload zsh/terminfo 2>/dev/null
|
zmodload zsh/terminfo 2>/dev/null
|
||||||
|
|
@ -196,7 +197,7 @@ if [[ -z $SOURCED && ( ${+terminfo} -eq 1 && -n ${terminfo[colors]} ) || \
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# List of hooks.
|
# Hooks
|
||||||
typeset -gAH ZINIT_ZLE_HOOKS_LIST
|
typeset -gAH ZINIT_ZLE_HOOKS_LIST
|
||||||
ZINIT_ZLE_HOOKS_LIST=(
|
ZINIT_ZLE_HOOKS_LIST=(
|
||||||
zle-isearch-exit 1
|
zle-isearch-exit 1
|
||||||
|
|
@ -208,16 +209,14 @@ ZINIT_ZLE_HOOKS_LIST=(
|
||||||
zle-keymap-select 1
|
zle-keymap-select 1
|
||||||
paste-insert 1
|
paste-insert 1
|
||||||
)
|
)
|
||||||
|
|
||||||
builtin setopt noaliases
|
builtin setopt noaliases
|
||||||
|
|
||||||
# ]]]
|
# ]]]
|
||||||
|
|
||||||
#
|
#
|
||||||
# Temporary substituting of functions-related functions.
|
# Temporary substituting of functions-related functions.
|
||||||
#
|
#
|
||||||
|
|
||||||
# FUNCTION: :zinit-reload-and-run. [[[
|
# FUNCTION: :zinit-reload-and-run [[[
|
||||||
# Marks given function ($3) for autoloading, and executes it triggering the
|
# Marks given function ($3) for autoloading, and executes it triggering the
|
||||||
# load. $1 is the fpath dedicated to the function, $2 are autoload options.
|
# load. $1 is the fpath dedicated to the function, $2 are autoload options.
|
||||||
# This function replaces "autoload -X", because using that on older Zsh
|
# This function replaces "autoload -X", because using that on older Zsh
|
||||||
|
|
@ -226,12 +225,12 @@ builtin setopt noaliases
|
||||||
# So basically one creates function stub that calls :zinit-reload-and-run()
|
# So basically one creates function stub that calls :zinit-reload-and-run()
|
||||||
# instead of "autoload -X".
|
# instead of "autoload -X".
|
||||||
#
|
#
|
||||||
|
# Author: Bart Schaefer
|
||||||
|
#
|
||||||
# $1 - FPATH dedicated to function
|
# $1 - FPATH dedicated to function
|
||||||
# $2 - autoload options
|
# $2 - autoload options
|
||||||
# $3 - function name (one that needs autoloading)
|
# $3 - function name (one that needs autoloading)
|
||||||
#
|
:zinit-reload-and-run() {
|
||||||
# Author: Bart Schaefer
|
|
||||||
:zinit-reload-and-run () {
|
|
||||||
local fpath_prefix="$1" autoload_opts="$2" func="$3"
|
local fpath_prefix="$1" autoload_opts="$2" func="$3"
|
||||||
shift 3
|
shift 3
|
||||||
|
|
||||||
|
|
@ -251,12 +250,11 @@ builtin setopt noaliases
|
||||||
# User wanted to call the function, not only load it.
|
# User wanted to call the function, not only load it.
|
||||||
"$func" "$@"
|
"$func" "$@"
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: :zinit-tmp-subst-autoload. [[[
|
# FUNCTION: :zinit-tmp-subst-autoload [[[
|
||||||
# Function defined to hijack plugin's calls to the `autoload' builtin.
|
# Hijack plugin's calls to the 'autoload' builtin.
|
||||||
#
|
#
|
||||||
# The hijacking is not only to gather report data, but also to.
|
# The hijacking gathers report data and runs custom `autoload' function, that doesn't need FPATH.
|
||||||
# run custom `autoload' function, that doesn't need FPATH.
|
:zinit-tmp-subst-autoload() {
|
||||||
:zinit-tmp-subst-autoload () {
|
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
builtin setopt extendedglob warncreateglobal typesetsilent rcquotes
|
builtin setopt extendedglob warncreateglobal typesetsilent rcquotes
|
||||||
local -a opts opts2 custom reply
|
local -a opts opts2 custom reply
|
||||||
|
|
@ -382,7 +380,7 @@ builtin setopt noaliases
|
||||||
|
|
||||||
return $retval
|
return $retval
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: :zinit-tmp-subst-bindkey. [[[
|
# FUNCTION: :zinit-tmp-subst-bindkey [[[
|
||||||
# Function defined to hijack plugin's calls to the `bindkey' builtin.
|
# Function defined to hijack plugin's calls to the `bindkey' builtin.
|
||||||
#
|
#
|
||||||
# The hijacking is to gather report data (which is used in unload).
|
# The hijacking is to gather report data (which is used in unload).
|
||||||
|
|
@ -534,7 +532,7 @@ builtin setopt noaliases
|
||||||
builtin bindkey "${pos[@]}"
|
builtin bindkey "${pos[@]}"
|
||||||
return $? # testable
|
return $? # testable
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: :zinit-tmp-subst-zstyle. [[[
|
# FUNCTION: :zinit-tmp-subst-zstyle [[[
|
||||||
# Function defined to hijack plugin's calls to the `zstyle' builtin.
|
# Function defined to hijack plugin's calls to the `zstyle' builtin.
|
||||||
#
|
#
|
||||||
# The hijacking is to gather report data (which is used in unload).
|
# The hijacking is to gather report data (which is used in unload).
|
||||||
|
|
@ -574,7 +572,7 @@ builtin setopt noaliases
|
||||||
builtin zstyle "${pos[@]}"
|
builtin zstyle "${pos[@]}"
|
||||||
return $? # testable
|
return $? # testable
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: :zinit-tmp-subst-alias. [[[
|
# FUNCTION: :zinit-tmp-subst-alias [[[
|
||||||
# Function defined to hijack plugin's calls to the `alias' builtin.
|
# Function defined to hijack plugin's calls to the `alias' builtin.
|
||||||
#
|
#
|
||||||
# The hijacking is to gather report data (which is used in unload).
|
# The hijacking is to gather report data (which is used in unload).
|
||||||
|
|
@ -625,7 +623,7 @@ builtin setopt noaliases
|
||||||
builtin alias "${pos[@]}"
|
builtin alias "${pos[@]}"
|
||||||
return $? # testable
|
return $? # testable
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: :zinit-tmp-subst-zle. [[[.
|
# FUNCTION: :zinit-tmp-subst-zle [[[.
|
||||||
# Function defined to hijack plugin's calls to the `zle' builtin.
|
# Function defined to hijack plugin's calls to the `zle' builtin.
|
||||||
#
|
#
|
||||||
# The hijacking is to gather report data (which is used in unload).
|
# The hijacking is to gather report data (which is used in unload).
|
||||||
|
|
@ -684,7 +682,7 @@ builtin setopt noaliases
|
||||||
builtin zle "${pos[@]}"
|
builtin zle "${pos[@]}"
|
||||||
return $? # testable
|
return $? # testable
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: :zinit-tmp-subst-compdef. [[[
|
# FUNCTION: :zinit-tmp-subst-compdef [[[
|
||||||
# Function defined to hijack plugin's calls to the `compdef' function.
|
# Function defined to hijack plugin's calls to the `compdef' function.
|
||||||
# The hijacking is not only for reporting, but also to save compdef
|
# The hijacking is not only for reporting, but also to save compdef
|
||||||
# calls so that `compinit' can be called after loading plugins.
|
# calls so that `compinit' can be called after loading plugins.
|
||||||
|
|
@ -696,11 +694,10 @@ builtin setopt noaliases
|
||||||
|
|
||||||
return 0 # testable
|
return 0 # testable
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-tmp-subst-on. [[[
|
# FUNCTION: .zinit-tmp-subst-on [[[
|
||||||
# Turn on temporary substituting of functions of builtins and functions according to passed
|
# Turn on temporary substituting of functions of builtins and functions according to passed
|
||||||
# mode ("load", "light", "light-b" or "compdef"). The temporary substituting of functions is
|
# mode ("load", "light", "light-b" or "compdef"). The temporary substituting of functions is
|
||||||
# to gather report data, and to hijack `autoload', `bindkey' and
|
# to gather report data, and to hijack 'autoload', 'bindkey' and 'compdef' calls.
|
||||||
# `compdef' calls.
|
|
||||||
.zinit-tmp-subst-on() {
|
.zinit-tmp-subst-on() {
|
||||||
local mode="$1"
|
local mode="$1"
|
||||||
|
|
||||||
|
|
@ -768,7 +765,7 @@ builtin setopt noaliases
|
||||||
|
|
||||||
builtin return 0
|
builtin return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-tmp-subst-off. [[[
|
# FUNCTION: .zinit-tmp-subst-off [[[
|
||||||
# Turn off temporary substituting of functions completely for a given mode ("load", "light",
|
# Turn off temporary substituting of functions completely for a given mode ("load", "light",
|
||||||
# "light-b" (i.e. the `trackbinds' mode) or "compdef").
|
# "light-b" (i.e. the `trackbinds' mode) or "compdef").
|
||||||
.zinit-tmp-subst-off() {
|
.zinit-tmp-subst-off() {
|
||||||
|
|
@ -814,8 +811,8 @@ builtin setopt noaliases
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: pmodload. [[[
|
# FUNCTION: pmodload [[[
|
||||||
# {function:pmodload} Compatibility with Prezto. Calls can be recursive.
|
# Compatibility with Prezto. Calls can be recursive
|
||||||
(( ${+functions[pmodload]} )) || pmodload() {
|
(( ${+functions[pmodload]} )) || pmodload() {
|
||||||
local -A ices
|
local -A ices
|
||||||
(( ${+ICE} )) && ices=( "${(kv)ICE[@]}" teleid '' )
|
(( ${+ICE} )) && ices=( "${(kv)ICE[@]}" teleid '' )
|
||||||
|
|
@ -832,14 +829,13 @@ builtin setopt noaliases
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Diff functions.
|
# Diff functions.
|
||||||
#
|
#
|
||||||
|
|
||||||
# FUNCTION: .zinit-diff-functions. [[[
|
# FUNCTION: .zinit-diff-functions [[[
|
||||||
# Implements detection of newly created functions. Performs
|
# Implements detection of newly created functions. Performs
|
||||||
# data gathering, computation is done in *-compute().
|
# data gathering, computation is done in *-compute().
|
||||||
#
|
#
|
||||||
|
|
@ -855,7 +851,7 @@ builtin setopt noaliases
|
||||||
} || \
|
} || \
|
||||||
ZINIT[FUNCTIONS_AFTER__$uspl2]+=" ${(j: :)${(qk)functions[@]}}"
|
ZINIT[FUNCTIONS_AFTER__$uspl2]+=" ${(j: :)${(qk)functions[@]}}"
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-diff-options. [[[
|
# FUNCTION: .zinit-diff-options [[[
|
||||||
# Implements detection of change in option state. Performs
|
# Implements detection of change in option state. Performs
|
||||||
# data gathering, computation is done in *-compute().
|
# data gathering, computation is done in *-compute().
|
||||||
#
|
#
|
||||||
|
|
@ -870,7 +866,7 @@ builtin setopt noaliases
|
||||||
} || \
|
} || \
|
||||||
ZINIT[OPTIONS_AFTER__$1]+=" ${(kv)options[@]}"
|
ZINIT[OPTIONS_AFTER__$1]+=" ${(kv)options[@]}"
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-diff-env. [[[
|
# FUNCTION: .zinit-diff-env [[[
|
||||||
# Implements detection of change in PATH and FPATH.
|
# Implements detection of change in PATH and FPATH.
|
||||||
#
|
#
|
||||||
# $1 - user/plugin (i.e. uspl2 format)
|
# $1 - user/plugin (i.e. uspl2 format)
|
||||||
|
|
@ -895,7 +891,7 @@ builtin setopt noaliases
|
||||||
ZINIT[FPATH_AFTER__$1]+=" ${tmp[*]}"
|
ZINIT[FPATH_AFTER__$1]+=" ${tmp[*]}"
|
||||||
}
|
}
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-diff-parameter. [[[
|
# FUNCTION: .zinit-diff-parameter [[[
|
||||||
# Implements detection of change in any parameter's existence and type.
|
# Implements detection of change in any parameter's existence and type.
|
||||||
# Performs data gathering, computation is done in *-compute().
|
# Performs data gathering, computation is done in *-compute().
|
||||||
#
|
#
|
||||||
|
|
@ -912,21 +908,20 @@ builtin setopt noaliases
|
||||||
ZINIT[PARAMETERS_AFTER__$1]+=" ${(j: :)${(qkv)parameters[@]}}"
|
ZINIT[PARAMETERS_AFTER__$1]+=" ${(j: :)${(qkv)parameters[@]}}"
|
||||||
}
|
}
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-diff. [[[
|
# FUNCTION: .zinit-diff [[[
|
||||||
# Performs diff actions of all types
|
# Performs diff actions of all types
|
||||||
.zinit-diff() {
|
.zinit-diff() {
|
||||||
.zinit-diff-functions "$1" "$2"
|
.zinit-diff-functions "$1" "$2"
|
||||||
.zinit-diff-options "$1" "$2"
|
.zinit-diff-options "$1" "$2"
|
||||||
.zinit-diff-env "$1" "$2"
|
.zinit-diff-env "$1" "$2"
|
||||||
.zinit-diff-parameter "$1" "$2"
|
.zinit-diff-parameter "$1" "$2"
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Utility functions.
|
# Utility functions.
|
||||||
#
|
#
|
||||||
|
|
||||||
# FUNCTION: .zinit-get-mtime-into. [[[
|
# FUNCTION: .zinit-get-mtime-into [[[
|
||||||
.zinit-get-mtime-into() {
|
.zinit-get-mtime-into() {
|
||||||
if (( ZINIT[HAVE_ZSTAT] )) {
|
if (( ZINIT[HAVE_ZSTAT] )) {
|
||||||
local -a arr
|
local -a arr
|
||||||
|
|
@ -936,14 +931,13 @@ builtin setopt noaliases
|
||||||
{ : ${(P)2::="$(stat -c %Y "$1")"}; } 2>/dev/null
|
{ : ${(P)2::="$(stat -c %Y "$1")"}; } 2>/dev/null
|
||||||
}
|
}
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-any-to-user-plugin. [[[
|
# FUNCTION: .zinit-any-to-user-plugin [[[
|
||||||
# Allows elastic plugin-spec across the code.
|
# Allows elastic plugin-spec across the code.
|
||||||
#
|
#
|
||||||
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
||||||
# $2 - plugin (only when $1 - i.e. user - given)
|
# $2 - plugin (only when $1 - i.e. user - given)
|
||||||
#
|
#
|
||||||
# Returns user and plugin in $reply.
|
# $REPLY - user and plugin
|
||||||
#
|
|
||||||
.zinit-any-to-user-plugin() {
|
.zinit-any-to-user-plugin() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
builtin setopt extendedglob typesetsilent noshortloops rcquotes \
|
builtin setopt extendedglob typesetsilent noshortloops rcquotes \
|
||||||
|
|
@ -985,7 +979,7 @@ builtin setopt noaliases
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-any-to-pid. [[[
|
# FUNCTION: .zinit-any-to-pid [[[
|
||||||
.zinit-any-to-pid() {
|
.zinit-any-to-pid() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
builtin setopt extendedglob typesetsilent noshortloops rcquotes \
|
builtin setopt extendedglob typesetsilent noshortloops rcquotes \
|
||||||
|
|
@ -1016,7 +1010,7 @@ builtin setopt noaliases
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-util-shands-path. [[[
|
# FUNCTION: .zinit-util-shands-path [[[
|
||||||
# Replaces parts of path with %HOME, etc.
|
# Replaces parts of path with %HOME, etc.
|
||||||
.zinit-util-shands-path() {
|
.zinit-util-shands-path() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
|
|
@ -1029,7 +1023,7 @@ builtin setopt noaliases
|
||||||
REPLY=${${1/(#b)(#s)(%|)(${(~j:|:)${(@k)map:#$HOME}}|$HOME|)/$map[$match[2]]}}
|
REPLY=${${1/(#b)(#s)(%|)(${(~j:|:)${(@k)map:#$HOME}}|$HOME|)/$map[$match[2]]}}
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-find-other-matches. [[[
|
# FUNCTION: .zinit-find-other-matches [[[
|
||||||
# Plugin's main source file is in general `name.plugin.zsh'. However,
|
# Plugin's main source file is in general `name.plugin.zsh'. However,
|
||||||
# there can be different conventions, if that file is not found, then
|
# there can be different conventions, if that file is not found, then
|
||||||
# this functions examines other conventions in the most sane order.
|
# this functions examines other conventions in the most sane order.
|
||||||
|
|
@ -1059,7 +1053,7 @@ builtin setopt noaliases
|
||||||
|
|
||||||
return $(( ${#reply} > 0 ? 0 : 1 ))
|
return $(( ${#reply} > 0 ? 0 : 1 ))
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-register-plugin. [[[
|
# FUNCTION: .zinit-register-plugin [[[
|
||||||
# Adds the plugin to ZINIT_REGISTERED_PLUGINS array and to the
|
# Adds the plugin to ZINIT_REGISTERED_PLUGINS array and to the
|
||||||
# zsh_loaded_plugins array (managed according to the plugin standard:
|
# zsh_loaded_plugins array (managed according to the plugin standard:
|
||||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html).
|
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html).
|
||||||
|
|
@ -1097,7 +1091,7 @@ builtin setopt noaliases
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-get-object-path. [[[
|
# FUNCTION: .zinit-get-object-path [[[
|
||||||
.zinit-get-object-path() {
|
.zinit-get-object-path() {
|
||||||
local type="$1" id_as="$2" local_dir dirname
|
local type="$1" id_as="$2" local_dir dirname
|
||||||
integer exists
|
integer exists
|
||||||
|
|
@ -1129,9 +1123,8 @@ builtin setopt noaliases
|
||||||
REPLY="$local_dir${dirname:+/$dirname}"
|
REPLY="$local_dir${dirname:+/$dirname}"
|
||||||
|
|
||||||
return $(( 1 - exists ))
|
return $(( 1 - exists ))
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
# FUNCTION: @zinit-substitute [[[
|
||||||
# FUNCTION: @zinit-substitute. [[[
|
|
||||||
@zinit-substitute() {
|
@zinit-substitute() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
builtin setopt extendedglob warncreateglobal typesetsilent noshortloops
|
builtin setopt extendedglob warncreateglobal typesetsilent noshortloops
|
||||||
|
|
@ -1175,7 +1168,7 @@ builtin setopt noaliases
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
# ]]]
|
# ]]]
|
||||||
# FUNCTION: @zinit-register-annex. [[[
|
# FUNCTION: @zinit-register-annex [[[
|
||||||
# Registers the z-annex inside Zinit – i.e. an Zinit extension
|
# Registers the z-annex inside Zinit – i.e. an Zinit extension
|
||||||
@zinit-register-annex() {
|
@zinit-register-annex() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
|
|
@ -1191,10 +1184,9 @@ builtin setopt noaliases
|
||||||
integer index="${type##[%a-zA-Z:_!-]##}"
|
integer index="${type##[%a-zA-Z:_!-]##}"
|
||||||
ZINIT_EXTS[ice-mods]="${ZINIT_EXTS[ice-mods]}${icemods:+|}${(j:|:)${(@)${(@s:|:)icemods}/(#b)(#s)(?)/$index-$match[1]}}"
|
ZINIT_EXTS[ice-mods]="${ZINIT_EXTS[ice-mods]}${icemods:+|}${(j:|:)${(@)${(@s:|:)icemods}/(#b)(#s)(?)/$index-$match[1]}}"
|
||||||
}
|
}
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
# FUNCTION: @zinit-register-hook [[[
|
||||||
# FUNCTION: @zinit-register-hook. [[[
|
# Registers the z-annex inside Zinit (i.e., an Zinit extension)
|
||||||
# Registers the z-annex inside Zinit – i.e. an Zinit extension
|
|
||||||
@zinit-register-hook() {
|
@zinit-register-hook() {
|
||||||
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
# zsh per default behaves differently in interactive sessions (escapes !) and
|
# zsh per default behaves differently in interactive sessions (escapes !) and
|
||||||
|
|
@ -1206,29 +1198,26 @@ builtin setopt noaliases
|
||||||
ZINIT_EXTS2[seqno]=$(( ${ZINIT_EXTS2[seqno]:-0} + 1 ))
|
ZINIT_EXTS2[seqno]=$(( ${ZINIT_EXTS2[seqno]:-0} + 1 ))
|
||||||
ZINIT_EXTS2[$key${${(M)type#hook:}:+ ${ZINIT_EXTS2[seqno]}}]="${ZINIT_EXTS2[seqno]} z-annex-data: ${(q)name} ${(q)type} ${(q)handler} '' ${(q)icemods}"
|
ZINIT_EXTS2[$key${${(M)type#hook:}:+ ${ZINIT_EXTS2[seqno]}}]="${ZINIT_EXTS2[seqno]} z-annex-data: ${(q)name} ${(q)type} ${(q)handler} '' ${(q)icemods}"
|
||||||
ZINIT_EXTS2[ice-mods]="${ZINIT_EXTS2[ice-mods]}${icemods:+|}$icemods"
|
ZINIT_EXTS2[ice-mods]="${ZINIT_EXTS2[ice-mods]}${icemods:+|}$icemods"
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
# FUNCTION: @zsh-plugin-run-on-unload [[[
|
||||||
# FUNCTION: @zsh-plugin-run-on-update. [[[
|
|
||||||
# The Plugin Standard required mechanism, see:
|
# The Plugin Standard required mechanism, see:
|
||||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||||
@zsh-plugin-run-on-unload() {
|
@zsh-plugin-run-on-unload() {
|
||||||
ICE[ps-on-unload]="${(j.; .)@}"
|
ICE[ps-on-unload]="${(j.; .)@}"
|
||||||
.zinit-pack-ice "$id_as" ""
|
.zinit-pack-ice "$id_as" ""
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
# FUNCTION: @zsh-plugin-run-on-update [[[
|
||||||
# FUNCTION: @zsh-plugin-run-on-update. [[[
|
|
||||||
# The Plugin Standard required mechanism
|
# The Plugin Standard required mechanism
|
||||||
@zsh-plugin-run-on-update() {
|
@zsh-plugin-run-on-update() {
|
||||||
ICE[ps-on-update]="${(j.; .)@}"
|
ICE[ps-on-update]="${(j.; .)@}"
|
||||||
.zinit-pack-ice "$id_as" ""
|
.zinit-pack-ice "$id_as" ""
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remaining functions.
|
# Remaining functions.
|
||||||
#
|
#
|
||||||
|
|
||||||
# FUNCTION: .zinit-prepare-home. [[[
|
# FUNCTION: .zinit-prepare-home [[[
|
||||||
# Creates all directories needed by Zinit, first checks if they
|
# Creates all directories needed by Zinit, first checks if they
|
||||||
# already exist.
|
# already exist.
|
||||||
.zinit-prepare-home() {
|
.zinit-prepare-home() {
|
||||||
|
|
@ -1287,12 +1276,13 @@ builtin setopt noaliases
|
||||||
command mkdir 2>/dev/null -p ${~ZINIT[MAN_DIR]}/man{1..9}
|
command mkdir 2>/dev/null -p ${~ZINIT[MAN_DIR]}/man{1..9}
|
||||||
}
|
}
|
||||||
# Copy Zinit manpage so that man is able to find it
|
# Copy Zinit manpage so that man is able to find it
|
||||||
[[ ! -f $ZINIT[MAN_DIR]/man1/zinit.1 ]] && {
|
[[ ! -f $ZINIT[MAN_DIR]/man1/zinit.1 || \
|
||||||
|
$ZINIT[MAN_DIR]/man1/zinit.1 -ot $ZINIT[BIN_DIR]/doc/zinit.1 ]] && {
|
||||||
command mkdir -p $ZINIT[MAN_DIR]/man1
|
command mkdir -p $ZINIT[MAN_DIR]/man1
|
||||||
command cp $ZINIT[BIN_DIR]/doc/zinit.1 $ZINIT[MAN_DIR]/man1
|
command cp -f $ZINIT[BIN_DIR]/doc/zinit.1 $ZINIT[MAN_DIR]/man1
|
||||||
}
|
}
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-load-object. [[[
|
# FUNCTION: .zinit-load-object [[[
|
||||||
.zinit-load-object() {
|
.zinit-load-object() {
|
||||||
local ___type="$1" ___id=$2
|
local ___type="$1" ___id=$2
|
||||||
local -a ___opt
|
local -a ___opt
|
||||||
|
|
@ -1308,7 +1298,7 @@ builtin setopt noaliases
|
||||||
return __retval
|
return __retval
|
||||||
}
|
}
|
||||||
# ]]]
|
# ]]]
|
||||||
# FUNCTION:.zinit-set-m-func() [[[
|
# FUNCTION: .zinit-set-m-func [[[
|
||||||
# Sets and withdraws the temporary, atclone/atpull time function `m`.
|
# Sets and withdraws the temporary, atclone/atpull time function `m`.
|
||||||
.zinit-set-m-func() {
|
.zinit-set-m-func() {
|
||||||
if [[ $1 == set ]]; then
|
if [[ $1 == set ]]; then
|
||||||
|
|
@ -1330,7 +1320,7 @@ builtin setopt noaliases
|
||||||
fi
|
fi
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-load-snippet. [[[
|
# FUNCTION: .zinit-load-snippet [[[
|
||||||
# Implements the exposed-to-user action of loading a snippet.
|
# Implements the exposed-to-user action of loading a snippet.
|
||||||
#
|
#
|
||||||
# $1 - url (can be local, absolute path).
|
# $1 - url (can be local, absolute path).
|
||||||
|
|
@ -1571,12 +1561,12 @@ builtin setopt noaliases
|
||||||
return retval
|
return retval
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-load. [[[
|
# FUNCTION: .zinit-load [[[
|
||||||
# Implements the exposed-to-user action of loading a plugin.
|
# Implements the exposed-to-user action of loading a plugin.
|
||||||
#
|
#
|
||||||
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
|
||||||
# $2 - plugin name, if the third format is used
|
# $2 - plugin name, if the third format is used
|
||||||
.zinit-load () {
|
.zinit-load() {
|
||||||
typeset -F 3 SECONDS=0
|
typeset -F 3 SECONDS=0
|
||||||
local ___mode="$3" ___limit="$4" ___rst=0 ___retval=0 ___key
|
local ___mode="$3" ___limit="$4" ___rst=0 ___retval=0 ___key
|
||||||
.zinit-any-to-user-plugin "$1" "$2"
|
.zinit-any-to-user-plugin "$1" "$2"
|
||||||
|
|
@ -1680,7 +1670,7 @@ builtin setopt noaliases
|
||||||
return ___retval
|
return ___retval
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-load-plugin. [[[
|
# FUNCTION: .zinit-load-plugin [[[
|
||||||
# Lower-level function for loading a plugin.
|
# Lower-level function for loading a plugin.
|
||||||
#
|
#
|
||||||
# $1 - user
|
# $1 - user
|
||||||
|
|
@ -1835,9 +1825,8 @@ builtin setopt noaliases
|
||||||
return ___retval
|
return ___retval
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-compdef-replay. [[[
|
# FUNCTION: .zinit-compdef-replay [[[
|
||||||
# Runs gathered compdef calls. This allows to run `compinit'
|
# Runs gathered compdef calls. This allows to run 'compinit' after loading plugins.
|
||||||
# after loading plugins.
|
|
||||||
.zinit-compdef-replay() {
|
.zinit-compdef-replay() {
|
||||||
local quiet="$1"
|
local quiet="$1"
|
||||||
typeset -a pos
|
typeset -a pos
|
||||||
|
|
@ -1863,7 +1852,7 @@ builtin setopt noaliases
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-compdef-clear. [[[
|
# FUNCTION: .zinit-compdef-clear [[[
|
||||||
# Implements user-exposed functionality to clear gathered compdefs.
|
# Implements user-exposed functionality to clear gathered compdefs.
|
||||||
.zinit-compdef-clear() {
|
.zinit-compdef-clear() {
|
||||||
local quiet="$1" count="${#ZINIT_COMPDEF_REPLAY}"
|
local quiet="$1" count="${#ZINIT_COMPDEF_REPLAY}"
|
||||||
|
|
@ -1871,11 +1860,11 @@ builtin setopt noaliases
|
||||||
[[ $quiet = -q ]] || +zinit-message "Compdef-replay cleared (it had {num}${count}{rst} entries)."
|
[[ $quiet = -q ]] || +zinit-message "Compdef-replay cleared (it had {num}${count}{rst} entries)."
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-add-report. [[[
|
# FUNCTION: .zinit-add-report [[[
|
||||||
# Adds a report line for given plugin.
|
# Adds a report line for given plugin.
|
||||||
#
|
#
|
||||||
# $1 - uspl2, i.e. user/plugin
|
# $1 - uspl2, i.e. user/plugin
|
||||||
# $2, ... - the text
|
# $2 - the text
|
||||||
.zinit-add-report() {
|
.zinit-add-report() {
|
||||||
# Use zinit binary module if available.
|
# Use zinit binary module if available.
|
||||||
[[ -n $1 ]] && { (( ${+builtins[zpmod]} && 0 )) && zpmod report-append "$1" "$2"$'\n' || ZINIT_REPORTS[$1]+="$2"$'\n'; }
|
[[ -n $1 ]] && { (( ${+builtins[zpmod]} && 0 )) && zpmod report-append "$1" "$2"$'\n' || ZINIT_REPORTS[$1]+="$2"$'\n'; }
|
||||||
|
|
@ -1883,7 +1872,7 @@ builtin setopt noaliases
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-add-fpath. [[[
|
# FUNCTION: .zinit-add-fpath [[[
|
||||||
.zinit-add-fpath() {
|
.zinit-add-fpath() {
|
||||||
[[ $1 = (-f|--front) ]] && { shift; integer front=1; }
|
[[ $1 = (-f|--front) ]] && { shift; integer front=1; }
|
||||||
.zinit-any-to-user-plugin "$1" ""
|
.zinit-any-to-user-plugin "$1" ""
|
||||||
|
|
@ -1897,9 +1886,9 @@ builtin setopt noaliases
|
||||||
}
|
}
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-run. [[[
|
# FUNCTION: .zinit-run [[[
|
||||||
# Run code inside plugin's folder
|
# Run code inside plugins folder
|
||||||
# It uses the `correct' parameter from upper's scope zinit().
|
# It uses the 'correct' parameter from uppers scope zinit().
|
||||||
.zinit-run() {
|
.zinit-run() {
|
||||||
if [[ $1 = (-l|--last) ]]; then
|
if [[ $1 = (-l|--last) ]]; then
|
||||||
{ set -- "${ZINIT[last-run-plugin]:-$(<${ZINIT[BIN_DIR]}/last-run-object.txt)}" "${@[2-correct,-1]}"; } &>/dev/null
|
{ set -- "${ZINIT[last-run-plugin]:-$(<${ZINIT[BIN_DIR]}/last-run-object.txt)}" "${@[2-correct,-1]}"; } &>/dev/null
|
||||||
|
|
@ -1927,9 +1916,9 @@ builtin setopt noaliases
|
||||||
fi
|
fi
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: +zinit-deploy-message. [[[
|
# FUNCTION: +zinit-deploy-message [[[
|
||||||
# Deploys a sub-prompt message to be displayed OR a `zle
|
# Deploys a sub-prompt message to be displayed OR a 'zle .reset-prompt'
|
||||||
# .reset-prompt' call to be invoked
|
# call to be invoked
|
||||||
+zinit-deploy-message() {
|
+zinit-deploy-message() {
|
||||||
[[ $1 = <-> && ( ${#} = 1 || ( $2 = (hup|nval|err) && ${#} = 2 ) ) ]] && { zle && {
|
[[ $1 = <-> && ( ${#} = 1 || ( $2 = (hup|nval|err) && ${#} = 2 ) ) ]] && { zle && {
|
||||||
local alltext text IFS=$'\n' nl=$'\n'
|
local alltext text IFS=$'\n' nl=$'\n'
|
||||||
|
|
@ -1941,14 +1930,14 @@ builtin setopt noaliases
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
local THEFD=13371337 hasw
|
local THEFD=13371337 hasw
|
||||||
# The expansion is: if there is @sleep: pfx, then use what's after.
|
# The expansion is: if there is @sleep: pfx, then use what is after.
|
||||||
# it, otherwise substitute 0
|
# it, otherwise substitute 0
|
||||||
exec {THEFD} < <(LANG=C sleep $(( 0.01 + ${${${(M)1#@sleep:}:+${1#@sleep:}}:-0} )); builtin print -r -- ${1:#(@msg|@sleep:*)} "${@[2,-1]}"; )
|
exec {THEFD} < <(LANG=C sleep $(( 0.01 + ${${${(M)1#@sleep:}:+${1#@sleep:}}:-0} )); builtin print -r -- ${1:#(@msg|@sleep:*)} "${@[2,-1]}"; )
|
||||||
command true # workaround a Zsh bug, see: https://www.zsh.org/mla/workers/2018/msg00966.html
|
command true # workaround a Zsh bug, see: https://www.zsh.org/mla/workers/2018/msg00966.html
|
||||||
builtin zle -F "$THEFD" +zinit-deploy-message
|
builtin zle -F "$THEFD" +zinit-deploy-message
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-formatter-dbg. [[[
|
# FUNCTION: .zinit-formatter-dbg [[[
|
||||||
.zinit-formatter-dbg() {
|
.zinit-formatter-dbg() {
|
||||||
builtin emulate -L zsh -o extendedglob
|
builtin emulate -L zsh -o extendedglob
|
||||||
REPLY=
|
REPLY=
|
||||||
|
|
@ -1957,7 +1946,7 @@ builtin setopt noaliases
|
||||||
fi
|
fi
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-formatter-auto. [[[
|
# FUNCTION: .zinit-formatter-auto [[[
|
||||||
.zinit-formatter-auto() {
|
.zinit-formatter-auto() {
|
||||||
emulate -L zsh -o extendedglob -o warncreateglobal -o typesetsilent
|
emulate -L zsh -o extendedglob -o warncreateglobal -o typesetsilent
|
||||||
local out in=$1 i wrk match spaces rest
|
local out in=$1 i wrk match spaces rest
|
||||||
|
|
@ -1977,7 +1966,7 @@ builtin setopt noaliases
|
||||||
rest=$match[3]
|
rest=$match[3]
|
||||||
wrk=${match[2]//---//}
|
wrk=${match[2]//---//}
|
||||||
REPLY=$wrk
|
REPLY=$wrk
|
||||||
# Is it a time ?
|
# Is it a time?
|
||||||
if [[ $wrk == ([[:space:]]##|(#s))[0-9.]##([[:space:]]##|(#e)) &&
|
if [[ $wrk == ([[:space:]]##|(#s))[0-9.]##([[:space:]]##|(#e)) &&
|
||||||
$rest == ([[:space:]]#|(#s))[sm]([[:space:]]##*|(#e)) || $wrk == ([[:space:]]##|(#s))[0-9.]##[sm]([[:space:]]##|(#e)) ]]; then
|
$rest == ([[:space:]]#|(#s))[sm]([[:space:]]##*|(#e)) || $wrk == ([[:space:]]##|(#s))[0-9.]##[sm]([[:space:]]##|(#e)) ]]; then
|
||||||
REPLY=$ZINIT[col-time]$wrk$ZINIT[col-rst]
|
REPLY=$ZINIT[col-time]$wrk$ZINIT[col-rst]
|
||||||
|
|
@ -1985,7 +1974,8 @@ builtin setopt noaliases
|
||||||
if [[ $wrk != *[sm]* ]]; then
|
if [[ $wrk != *[sm]* ]]; then
|
||||||
rest=$ZINIT[col-time]${(M)rest##[[:space:]]#[sm]}$ZINIT[col-rst]${rest##[[:space:]]#[sm]}
|
rest=$ZINIT[col-time]${(M)rest##[[:space:]]#[sm]}$ZINIT[col-rst]${rest##[[:space:]]#[sm]}
|
||||||
fi
|
fi
|
||||||
# Is it a number? TODO: differentiate floats
|
# Is it a number?
|
||||||
|
# TODO: differentiate floats
|
||||||
elif [[ $wrk == ([[:space:]]##|(#s))[0-9.]##([[:space:]]##|(#e)) ]]; then
|
elif [[ $wrk == ([[:space:]]##|(#s))[0-9.]##([[:space:]]##|(#e)) ]]; then
|
||||||
REPLY=$ZINIT[col-num]$wrk$ZINIT[col-rst]
|
REPLY=$ZINIT[col-num]$wrk$ZINIT[col-rst]
|
||||||
# Is it a URL?
|
# Is it a URL?
|
||||||
|
|
@ -2024,7 +2014,7 @@ builtin setopt noaliases
|
||||||
REPLY=${out//$'\u00a0'/ }
|
REPLY=${out//$'\u00a0'/ }
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-formatter-pid. [[[
|
# FUNCTION: .zinit-formatter-pid [[[
|
||||||
.zinit-formatter-pid() {
|
.zinit-formatter-pid() {
|
||||||
builtin emulate -L zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -L zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
|
|
||||||
|
|
@ -2047,17 +2037,17 @@ builtin setopt noaliases
|
||||||
REPLY=$pbz$REPLY$kbz
|
REPLY=$pbz$REPLY$kbz
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-formatter-bar. [[[
|
# FUNCTION: .zinit-formatter-bar [[[
|
||||||
.zinit-formatter-bar() {
|
.zinit-formatter-bar() {
|
||||||
.zinit-formatter-bar-util ─ bar
|
.zinit-formatter-bar-util ─ bar
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-formatter-th-bar. [[[
|
# FUNCTION: .zinit-formatter-th-bar [[[
|
||||||
.zinit-formatter-th-bar() {
|
.zinit-formatter-th-bar() {
|
||||||
.zinit-formatter-bar-util ━ th-bar
|
.zinit-formatter-bar-util ━ th-bar
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-formatter-bar-util. [[[
|
# FUNCTION: .zinit-formatter-bar-util [[[
|
||||||
.zinit-formatter-bar-util() {
|
.zinit-formatter-bar-util() {
|
||||||
if [[ $LANG == (#i)*utf-8* ]]; then
|
if [[ $LANG == (#i)*utf-8* ]]; then
|
||||||
ch=$1
|
ch=$1
|
||||||
|
|
@ -2068,7 +2058,7 @@ builtin setopt noaliases
|
||||||
REPLY=$ZINIT[col-$2]${(pl:COLUMNS-1::$ch:):-}$ZINIT[col-rst]
|
REPLY=$ZINIT[col-$2]${(pl:COLUMNS-1::$ch:):-}$ZINIT[col-rst]
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-formatter-url. [[[
|
# FUNCTION: .zinit-formatter-url [[[
|
||||||
.zinit-formatter-url() {
|
.zinit-formatter-url() {
|
||||||
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
# 1:proto 3:domain/5:start 6:end-of-it 7:no-dot-domain 9:file-path
|
# 1:proto 3:domain/5:start 6:end-of-it 7:no-dot-domain 9:file-path
|
||||||
|
|
@ -2096,7 +2086,7 @@ builtin setopt noaliases
|
||||||
}
|
}
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: +zinit-message-formatter [[[
|
# FUNCTION: .zinit-main-message-formatter [[[
|
||||||
.zinit-main-message-formatter() {
|
.zinit-main-message-formatter() {
|
||||||
if [[ -z $1 && -z $2 && -z $3 ]]; then
|
if [[ -z $1 && -z $2 && -z $3 ]]; then
|
||||||
REPLY=""
|
REPLY=""
|
||||||
|
|
@ -2123,7 +2113,7 @@ builtin setopt noaliases
|
||||||
REPLY=$in_prepend${ZINIT[col-$2]:-$1}$influx$3$append
|
REPLY=$in_prepend${ZINIT[col-$2]:-$1}$influx$3$append
|
||||||
|
|
||||||
# Replace new lines with characters that work the same but are not
|
# Replace new lines with characters that work the same but are not
|
||||||
# deleted in the substitution $ (...) - vertical tab 0xB ↔ 13 in the system
|
# deleted in the substitution $ (...) - vertical tab 0xB <-> 13 in the system
|
||||||
# octagonal connected back carriage (015).
|
# octagonal connected back carriage (015).
|
||||||
local nl=$'\n' vertical=$'\013' carriager=$'\015'
|
local nl=$'\n' vertical=$'\013' carriager=$'\015'
|
||||||
REPLY=${REPLY//$nl/$vertical$carriager}
|
REPLY=${REPLY//$nl/$vertical$carriager}
|
||||||
|
|
@ -2131,7 +2121,7 @@ builtin setopt noaliases
|
||||||
# REPLY+="x(${3}…)"
|
# REPLY+="x(${3}…)"
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: +zinit-message. [[[
|
# FUNCTION: +zinit-message [[[
|
||||||
+zinit-message() {
|
+zinit-message() {
|
||||||
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
local opt msg
|
local opt msg
|
||||||
|
|
@ -2164,7 +2154,7 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
fi
|
fi
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: +zinit-prehelp-usage-message. [[[
|
# FUNCTION: +zinit-prehelp-usage-message [[[
|
||||||
+zinit-prehelp-usage-message() {
|
+zinit-prehelp-usage-message() {
|
||||||
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
local cmd=$1 allowed=$2 sep="$ZINIT[col-msg2], $ZINIT[col-ehi]" \
|
local cmd=$1 allowed=$2 sep="$ZINIT[col-msg2], $ZINIT[col-ehi]" \
|
||||||
|
|
@ -2209,18 +2199,15 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
"the list of the {cmd}subcommands$bcol.{rst}"
|
"the list of the {cmd}subcommands$bcol.{rst}"
|
||||||
}
|
}
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
# FUNCTION: .zinit-parse-opts [[[
|
||||||
# FUNCTION: +zinit-parse-opts. [[[
|
|
||||||
.zinit-parse-opts() {
|
.zinit-parse-opts() {
|
||||||
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
reply=( "${(@)${@[2,-1]//([ $'\t']##|(#s))(#b)(${(~j.|.)${(@s.|.)___opt_map[$1]}})(#B)([ $'\t']##|(#e))/${OPTS[${___opt_map[${match[1]}]%%:*}]::=1}ß←↓→}:#1ß←↓→}" )
|
reply=( "${(@)${@[2,-1]//([ $'\t']##|(#s))(#b)(${(~j.|.)${(@s.|.)___opt_map[$1]}})(#B)([ $'\t']##|(#e))/${OPTS[${___opt_map[${match[1]}]%%:*}]::=1}ß←↓→}:#1ß←↓→}" )
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
#
|
# Ice support
|
||||||
# Ice support.
|
|
||||||
#
|
|
||||||
|
|
||||||
# FUNCTION: .zinit-ice. [[[
|
# FUNCTION: .zinit-ice [[[
|
||||||
# Parses ICE specification, puts the result into ICE global hash.
|
# Parses ICE specification, puts the result into ICE global hash.
|
||||||
# The ice-spec is valid for next command only (i.e. it "melts"), but
|
# The ice-spec is valid for next command only (i.e. it "melts"), but
|
||||||
# it can then stick to plugin and activate e.g. at update.
|
# it can then stick to plugin and activate e.g. at update.
|
||||||
|
|
@ -2240,19 +2227,17 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
return retval
|
return retval
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-pack-ice. [[[
|
# FUNCTION: .zinit-pack-ice [[[
|
||||||
# Remembers all ice-mods, assigns them to concrete plugin. Ice spec
|
# Remembers all ice-mods, assigns them to concrete plugin. Ice spec
|
||||||
# is in general forgotten for second-next command (that's why it's
|
# is in general forgotten for second-next command (i.e., ice melts quickly), however they
|
||||||
# called "ice" - it melts), however they glue to the object (plugin
|
# glue to the object (plugin or snippet) mentioned in the next command for later use with (e.g. 'zinit update ...').
|
||||||
# or snippet) mentioned in the next command – for later use with e.g.
|
|
||||||
# `zinit update ...'.
|
|
||||||
.zinit-pack-ice() {
|
.zinit-pack-ice() {
|
||||||
ZINIT_SICE[$1${1:+${2:+/}}$2]+="${(j: :)${(qkv)ICE[@]}} "
|
ZINIT_SICE[$1${1:+${2:+/}}$2]+="${(j: :)${(qkv)ICE[@]}} "
|
||||||
ZINIT_SICE[$1${1:+${2:+/}}$2]="${ZINIT_SICE[$1${1:+${2:+/}}$2]# }"
|
ZINIT_SICE[$1${1:+${2:+/}}$2]="${ZINIT_SICE[$1${1:+${2:+/}}$2]# }"
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-load-ices. [[[
|
# FUNCTION: .zinit-load-ices [[[
|
||||||
.zinit-load-ices() {
|
.zinit-load-ices() {
|
||||||
local id_as="$1" ___key ___path
|
local id_as="$1" ___key ___path
|
||||||
local -a ice_order
|
local -a ice_order
|
||||||
|
|
@ -2261,7 +2246,7 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
${(@)${(A@kons:|:)${ZINIT_EXTS[ice-mods]//\'\'/}}/(#s)<->-/}
|
${(@)${(A@kons:|:)${ZINIT_EXTS[ice-mods]//\'\'/}}/(#s)<->-/}
|
||||||
)
|
)
|
||||||
___path="${ZINIT[PLUGINS_DIR]}/${id_as//\//---}"/._zinit
|
___path="${ZINIT[PLUGINS_DIR]}/${id_as//\//---}"/._zinit
|
||||||
# TODO snippet's dir computation…
|
# TODO: snippets dir computation
|
||||||
if [[ ! -d $___path ]] {
|
if [[ ! -d $___path ]] {
|
||||||
if ! .zinit-get-object-path snippet "${id_as//\//---}"; then
|
if ! .zinit-get-object-path snippet "${id_as//\//---}"; then
|
||||||
return 1
|
return 1
|
||||||
|
|
@ -2279,7 +2264,7 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-setup-params. [[[
|
# FUNCTION: .zinit-setup-params [[[
|
||||||
.zinit-setup-params() {
|
.zinit-setup-params() {
|
||||||
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
reply=( ${(@)${(@s.;.)ICE[param]}/(#m)*/${${MATCH%%(-\>|→|=\>)*}//((#s)[[:space:]]##|[[:space:]]##(#e))}${${(M)MATCH#*(-\>|→|=\>)}:+\=${${MATCH#*(-\>|→|=\>)}//((#s)[[:space:]]##|[[:space:]]##(#e))}}} )
|
reply=( ${(@)${(@s.;.)ICE[param]}/(#m)*/${${MATCH%%(-\>|→|=\>)*}//((#s)[[:space:]]##|[[:space:]]##(#e))}${${(M)MATCH#*(-\>|→|=\>)}:+\=${${MATCH#*(-\>|→|=\>)}//((#s)[[:space:]]##|[[:space:]]##(#e))}}} )
|
||||||
|
|
@ -2290,18 +2275,18 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
# Turbo.
|
# Turbo.
|
||||||
#
|
#
|
||||||
|
|
||||||
# FUNCTION: .zinit-run-task. [[[
|
# FUNCTION: .zinit-run-task [[[
|
||||||
# A backend, worker function of .zinit-scheduler. It obtains the tasks
|
# A backend, worker function of .zinit-scheduler. It obtains the tasks
|
||||||
# index and a few of its properties (like the type: plugin, snippet,
|
# index and a few of its properties (like the type: plugin, snippet,
|
||||||
# service plugin, service snippet) and executes it first checking for
|
# service plugin, service snippet) and executes it first checking for
|
||||||
# additional conditions (like non-numeric wait'' ice).
|
# additional conditions (like non-numeric wait'' ice).
|
||||||
#
|
#
|
||||||
# $1 - the pass number, either 1st or 2nd pass
|
# $1 - current pass: 1 or 2
|
||||||
# $2 - the time assigned to the task
|
# $2 - time assigned to the task
|
||||||
# $3 - type: plugin, snippet, service plugin, service snippet
|
# $3 - type: plugin, service plugin, service snippet, snippet
|
||||||
# $4 - task's index in the ZINIT[WAIT_ICE_...] fields
|
# $4 - tasks index in the ZINIT[WAIT_ICE_...] fields
|
||||||
# $5 - mode: load or light
|
# $5 - mode: load, light
|
||||||
# $6 - the plugin-spec or snippet URL or alias name (from id-as'')
|
# $6 - details: alias name (derived from id-as''), plugin-spec, or snippet URL
|
||||||
.zinit-run-task() {
|
.zinit-run-task() {
|
||||||
local ___pass="$1" ___t="$2" ___tpe="$3" ___idx="$4" ___mode="$5" ___id="${(Q)6}" ___opt="${(Q)7}" ___action ___s=1 ___retval=0
|
local ___pass="$1" ___t="$2" ___tpe="$3" ___idx="$4" ___mode="$5" ___id="${(Q)6}" ___opt="${(Q)7}" ___action ___s=1 ___retval=0
|
||||||
|
|
||||||
|
|
@ -2350,15 +2335,14 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
[[ ${REPLY::=$___action} = \!* ]] && zle && zle .reset-prompt
|
[[ ${REPLY::=$___action} = \!* ]] && zle && zle .reset-prompt
|
||||||
|
|
||||||
return ___s
|
return ___s
|
||||||
}
|
} # ]]]
|
||||||
# ]]]
|
|
||||||
|
|
||||||
# FUNCTION: .zinit-submit-turbo. [[[
|
# FUNCTION: .zinit-submit-turbo [[[
|
||||||
# If `zinit load`, `zinit light` or `zinit snippet` will be
|
# If `zinit load`, `zinit light` or `zinit snippet` will be
|
||||||
# preceded with `wait', `load', `unload' or `on-update-of`/`subscribe'
|
# preceded with 'wait', 'load', 'unload' or 'on-update-of'/'subscribe'
|
||||||
# ice-mods then the plugin or snipped is to be loaded in turbo-mode,
|
# ice-mods then the plugin or snipped is to be loaded in turbo-mode,
|
||||||
# and this function adds it to internal data structures, so that
|
# and this function adds it to internal data structures. @zinit-scheduler uses the data to
|
||||||
# @zinit-scheduler can run (load, unload) this as a task.
|
# create load or unload tasks.
|
||||||
.zinit-submit-turbo() {
|
.zinit-submit-turbo() {
|
||||||
local tpe="$1" mode="$2" opt_uspl2="$3" opt_plugin="$4"
|
local tpe="$1" mode="$2" opt_uspl2="$3" opt_plugin="$4"
|
||||||
|
|
||||||
|
|
@ -2377,7 +2361,7 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
ZINIT_TASKS+=( "${${ICE[wait]:+0}:-1}+0+1 $tpe ${ZINIT[WAIT_IDX]} ${mode:-_} ${(q)id} ${opt_plugin:+${(q)opt_uspl2}}" )
|
ZINIT_TASKS+=( "${${ICE[wait]:+0}:-1}+0+1 $tpe ${ZINIT[WAIT_IDX]} ${mode:-_} ${(q)id} ${opt_plugin:+${(q)opt_uspl2}}" )
|
||||||
fi
|
fi
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: -zinit_scheduler_add_sh. [[[
|
# FUNCTION: -zinit_scheduler_add_sh [[[
|
||||||
# Copies task into ZINIT_RUN array, called when a task timeouts.
|
# Copies task into ZINIT_RUN array, called when a task timeouts.
|
||||||
# A small function ran from pattern in /-substitution as a math
|
# A small function ran from pattern in /-substitution as a math
|
||||||
# function.
|
# function.
|
||||||
|
|
@ -2390,14 +2374,14 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
return idx
|
return idx
|
||||||
fi
|
fi
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: @zinit-scheduler. [[[
|
# FUNCTION: @zinit-scheduler [[[
|
||||||
# Searches for timeout tasks, executes them. There's an array of tasks
|
# Searches for timeout tasks, executes them. Theres an array of tasks
|
||||||
# waiting for execution, this scheduler manages them, detects which ones
|
# waiting for execution, this scheduler manages them, detects which ones
|
||||||
# should be run at current moment, decides to remove (or not) them from
|
# should be run at current moment, decides to remove (or not) them from
|
||||||
# the array after execution.
|
# the array after execution.
|
||||||
#
|
#
|
||||||
# $1 - if "following", then it is non-first (second and more)
|
# $1 - if "following", then it is non-first (second and more)
|
||||||
# invocation of the scheduler; this results in chain of `sched'
|
# invocation of the scheduler; this results in chain of 'sched'
|
||||||
# invocations that results in repetitive @zinit-scheduler activity.
|
# invocations that results in repetitive @zinit-scheduler activity.
|
||||||
#
|
#
|
||||||
# if "burst", then all tasks are marked timeout and executed one
|
# if "burst", then all tasks are marked timeout and executed one
|
||||||
|
|
@ -2405,7 +2389,6 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
# needs to install all turbo-mode plugins without any hesitation
|
# needs to install all turbo-mode plugins without any hesitation
|
||||||
# (delay), i.e. "burst" allows to run package installations from
|
# (delay), i.e. "burst" allows to run package installations from
|
||||||
# script, not from prompt.
|
# script, not from prompt.
|
||||||
#
|
|
||||||
@zinit-scheduler() {
|
@zinit-scheduler() {
|
||||||
integer ___ret="${${ZINIT[lro-data]%:*}##*:}"
|
integer ___ret="${${ZINIT[lro-data]%:*}##*:}"
|
||||||
# lro stands for lastarg-retval-option.
|
# lro stands for lastarg-retval-option.
|
||||||
|
|
@ -2428,7 +2411,7 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
# Example entry:
|
# Example entry:
|
||||||
# 1531252764+2+1 p 18 light zdharma/zsh-diff-so-fancy
|
# 1531252764+2+1 p 18 light zdharma/zsh-diff-so-fancy
|
||||||
#
|
#
|
||||||
# This either doesn't change ZINIT_TASKS entry - when
|
# This either doesnt change ZINIT_TASKS entry - when
|
||||||
# ___i is used in the ternary expression, or replaces
|
# ___i is used in the ternary expression, or replaces
|
||||||
# an entry with "<no-data>", i.e. ZINIT_TASKS[1] entry.
|
# an entry with "<no-data>", i.e. ZINIT_TASKS[1] entry.
|
||||||
integer ___idx1 ___idx2
|
integer ___idx1 ___idx2
|
||||||
|
|
@ -2472,9 +2455,9 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
# in "1531252764+2" and replace it with current time.
|
# in "1531252764+2" and replace it with current time.
|
||||||
ZINIT_TASKS=( ${ZINIT_TASKS[@]/(#b)([0-9]##)(*)/$(( ${match[1]} <= 1 ? ${match[1]} : ___t ))${match[2]}} )
|
ZINIT_TASKS=( ${ZINIT_TASKS[@]/(#b)([0-9]##)(*)/$(( ${match[1]} <= 1 ? ${match[1]} : ___t ))${match[2]}} )
|
||||||
}
|
}
|
||||||
# There's a bug in Zsh: first sched call would not be issued
|
# Theres a bug in Zsh: first sched call would not be issued
|
||||||
# until a key-press, if "sched +1 ..." would be called inside
|
# until a key-press, if "sched +1 ..." would be called inside
|
||||||
# zle -F handler. So it's done here, in precmd-handle code.
|
# zle -F handler. So its done here, in precmd-handle code.
|
||||||
sched +1 'ZINIT[lro-data]="$_:$?:${options[printexitvalue]}"; @zinit-scheduler following ${ZINIT[lro-data]%:*:*}'
|
sched +1 'ZINIT[lro-data]="$_:$?:${options[printexitvalue]}"; @zinit-scheduler following ${ZINIT[lro-data]%:*:*}'
|
||||||
|
|
||||||
AFD=13371337 # for older Zsh + noclobber option
|
AFD=13371337 # for older Zsh + noclobber option
|
||||||
|
|
@ -2513,9 +2496,9 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
# Exposed functions.
|
# Exposed functions.
|
||||||
#
|
#
|
||||||
|
|
||||||
# FUNCTION: zinit. [[[
|
# FUNCTION: zinit [[[
|
||||||
# Main function directly exposed to user, obtains subcommand and its
|
# Entrypoint function directly exposed to user, consumes subcommands with respective arguments,
|
||||||
# arguments, has completion.
|
# and completion.
|
||||||
zinit() {
|
zinit() {
|
||||||
local -A ICE ZINIT_ICE
|
local -A ICE ZINIT_ICE
|
||||||
ICE=( "${(kv)ZINIT_ICES[@]}" )
|
ICE=( "${(kv)ZINIT_ICES[@]}" )
|
||||||
|
|
@ -2526,7 +2509,7 @@ zinit() {
|
||||||
local -a match mbegin mend
|
local -a match mbegin mend
|
||||||
local MATCH cmd ___q="\`" ___q2="'" IFS=$' \t\n\0'; integer MBEGIN MEND
|
local MATCH cmd ___q="\`" ___q2="'" IFS=$' \t\n\0'; integer MBEGIN MEND
|
||||||
|
|
||||||
# An annex's subcommand might use the reply vars.
|
# An annexs subcommand might use the reply vars.
|
||||||
match=( ${ZINIT_EXTS[(I)z-annex subcommand:$1]} )
|
match=( ${ZINIT_EXTS[(I)z-annex subcommand:$1]} )
|
||||||
if (( !${#match} )) {
|
if (( !${#match} )) {
|
||||||
local -a reply; local REPLY
|
local -a reply; local REPLY
|
||||||
|
|
@ -3117,43 +3100,71 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice
|
||||||
|
|
||||||
return ___retval
|
return ___retval
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: zicdreplay. [[[
|
# FUNCTION: zicdreplay [[[
|
||||||
# A function that can be invoked from within `atinit', `atload', etc.
|
# A function that can be invoked from within "atinit", "atload", etc.
|
||||||
# ice-mod. It works like `zinit cdreplay', which cannot be invoked
|
# ice-mod. It works like "zinit cdreplay", which cannot be invoked from such hook ices
|
||||||
# from such hook ices.
|
zicdreplay() {
|
||||||
zicdreplay() { .zinit-compdef-replay -q; }
|
.zinit-compdef-replay -q
|
||||||
# ]]]
|
} # ]]]
|
||||||
# FUNCTION: zicdclear. [[[
|
# FUNCTION: zicdclear [[[
|
||||||
# A wrapper for `zinit cdclear -q' which can be called from hook
|
# A wrapper for "zinit cdclear -q" which can be called from hook
|
||||||
# ices like the atinit'', atload'', etc. ices.
|
# ices like the atinit"", atload"", etc. ices.
|
||||||
zicdclear() { .zinit-compdef-clear -q; }
|
zicdclear() {
|
||||||
# ]]]
|
.zinit-compdef-clear -q
|
||||||
# FUNCTION: zicompinit. [[[
|
} # ]]]
|
||||||
# A function that can be invoked from within `atinit', `atload', etc.
|
# FUNCTION: zicompinit [[[
|
||||||
# ice-mod. It runs `autoload compinit; compinit' and respects
|
# A function that can be invoked from within "atinit", "atload", etc.
|
||||||
|
# ice-mod. It runs "autoload compinit; compinit" and respects
|
||||||
# ZINIT[ZCOMPDUMP_PATH] and ZINIT[COMPINIT_OPTS].
|
# ZINIT[ZCOMPDUMP_PATH] and ZINIT[COMPINIT_OPTS].
|
||||||
zicompinit() { autoload -Uz compinit; compinit -d ${ZINIT[ZCOMPDUMP_PATH]:-${ZDOTDIR:-$HOME}/.zcompdump} "${(Q@)${(z@)ZINIT[COMPINIT_OPTS]}}"; }
|
zicompinit() {
|
||||||
# ]]]
|
autoload -Uz compinit
|
||||||
# FUNCTION: zicompdef. [[[
|
compinit -d ${ZINIT[ZCOMPDUMP_PATH]:-${ZDOTDIR:-$HOME}/.zcompdump} "${(Q@)${(z@)ZINIT[COMPINIT_OPTS]}}"
|
||||||
# Stores compdef for a replay with `zicdreplay' (turbo mode) or
|
} # ]]]
|
||||||
# with `zinit cdreplay' (normal mode). An utility functton of
|
# FUNCTION: zicompdef [[[
|
||||||
# an undefined use case.
|
# Stores compdef for a replay with "zicdreplay" (turbo mode) or
|
||||||
zicompdef() { ZINIT_COMPDEF_REPLAY+=( "${(j: :)${(q)@}}" ); }
|
# with "zinit cdreplay" (normal mode). An utility functton of an undefined use case.
|
||||||
# ]]]
|
zicompdef() {
|
||||||
# FUNCTION: @autoload. [[[
|
ZINIT_COMPDEF_REPLAY+=( "${(j: :)${(q)@}}" )
|
||||||
|
} # ]]]
|
||||||
|
# FUNCTION: @autoload [[[
|
||||||
@autoload() {
|
@autoload() {
|
||||||
:zinit-tmp-subst-autoload -Uz \
|
:zinit-tmp-subst-autoload -Uz \
|
||||||
${(s: :)${${(j: :)${@#\!}}//(#b)((*)(->|=>|→)(*)|(*))/${match[2]:+$match[2] -S $match[4]}${match[5]:+${match[5]} -S ${match[5]}}}} \
|
${(s: :)${${(j: :)${@#\!}}//(#b)((*)(->|=>|→)(*)|(*))/${match[2]:+$match[2] \
|
||||||
${${${(@M)${@#\!}:#*(->|=>|→)*}}:+-C} ${${@#\!}:+-C}
|
-S $match[4]}${match[5]:+${match[5]} \
|
||||||
|
-S ${match[5]}}}} \
|
||||||
|
${${${(@M)${@#\!}:#*(->|=>|→)*}}:+-C} \
|
||||||
|
${${@#\!}:+-C}
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# Compatibility functions. [[[
|
#
|
||||||
zplugin() { zinit "$@"; }
|
# Compatibility functions
|
||||||
zpcdreplay() { .zinit-compdef-replay -q; }
|
#
|
||||||
zpcdclear() { .zinit-compdef-clear -q; }
|
|
||||||
zpcompinit() { autoload -Uz compinit; compinit -d ${ZINIT[ZCOMPDUMP_PATH]:-${ZDOTDIR:-$HOME}/.zcompdump} "${(Q@)${(z@)ZINIT[COMPINIT_OPTS]}}"; }
|
# FUNCTION: zplugin [[[
|
||||||
zpcompdef() { ZINIT_COMPDEF_REPLAY+=( "${(j: :)${(q)@}}" ); }
|
zplugin() {
|
||||||
# ]]]
|
zinit "$@"
|
||||||
|
} # ]]]
|
||||||
|
|
||||||
|
# FUNCTION: zpcdreplay [[[
|
||||||
|
zpcdreplay() {
|
||||||
|
.zinit-compdef-replay -q
|
||||||
|
} # ]]]
|
||||||
|
|
||||||
|
# FUNCTION: zpcdclear [[[
|
||||||
|
zpcdclear() {
|
||||||
|
.zinit-compdef-clear -q
|
||||||
|
} # ]]]
|
||||||
|
|
||||||
|
# FUNCTION: zpcompinit [[[
|
||||||
|
zpcompinit() {
|
||||||
|
autoload -Uz compinit
|
||||||
|
compinit -d ${ZINIT[ZCOMPDUMP_PATH]:-${ZDOTDIR:-$HOME}/.zcompdump} "${(Q@)${(z@)ZINIT[COMPINIT_OPTS]}}"
|
||||||
|
} # ]]]
|
||||||
|
|
||||||
|
# FUNCTION: zpcompdef [[[
|
||||||
|
zpcompdef() {
|
||||||
|
ZINIT_COMPDEF_REPLAY+=( "${(j: :)${(q)@}}" )
|
||||||
|
} # ]]]
|
||||||
|
|
||||||
#
|
#
|
||||||
# Source-executed code.
|
# Source-executed code.
|
||||||
|
|
@ -3171,23 +3182,22 @@ functions -M -- zinit_scheduler_add 1 1 -zinit_scheduler_add_sh 2>/dev/null
|
||||||
zmodload zsh/zpty zsh/system 2>/dev/null
|
zmodload zsh/zpty zsh/system 2>/dev/null
|
||||||
zmodload -F zsh/stat b:zstat 2>/dev/null && ZINIT[HAVE_ZSTAT]=1
|
zmodload -F zsh/stat b:zstat 2>/dev/null && ZINIT[HAVE_ZSTAT]=1
|
||||||
|
|
||||||
# code. [[[
|
# code [[[
|
||||||
builtin alias zpl=zinit zplg=zinit zi=zinit zini=zinit
|
builtin alias zpl=zinit zplg=zinit zi=zinit zini=zinit
|
||||||
|
|
||||||
.zinit-prepare-home
|
.zinit-prepare-home
|
||||||
|
|
||||||
# Remember source's timestamps for the automatic-reload feature.
|
# Remember source timestamps for the automatic-reload feature.
|
||||||
typeset -g ZINIT_TMP
|
typeset -g ZINIT_TMP
|
||||||
for ZINIT_TMP ( "" -side -install -autoload ) {
|
for ZINIT_TMP ( "" -side -install -autoload ) {
|
||||||
.zinit-get-mtime-into "${ZINIT[BIN_DIR]}/zinit$ZINIT_TMP.zsh" "ZINIT[mtime$ZINIT_TMP]"
|
.zinit-get-mtime-into "${ZINIT[BIN_DIR]}/zinit$ZINIT_TMP.zsh" "ZINIT[mtime$ZINIT_TMP]"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Simulate existence of _local/zinit plugin.
|
# Simulate existence of _local/zinit plugin (enables cuninstall of related completions)
|
||||||
# This will allow to cuninstall of its completion
|
|
||||||
ZINIT_REGISTERED_PLUGINS=( _local/zinit "${(u)ZINIT_REGISTERED_PLUGINS[@]:#_local/zinit}" )
|
ZINIT_REGISTERED_PLUGINS=( _local/zinit "${(u)ZINIT_REGISTERED_PLUGINS[@]:#_local/zinit}" )
|
||||||
ZINIT[STATES___local/zinit]=1
|
ZINIT[STATES___local/zinit]=1
|
||||||
|
|
||||||
# Inform Prezto that the compdef function is available.
|
# inform prezto that the compdef function is available.
|
||||||
zstyle ':prezto:module:completion' loaded 1
|
zstyle ':prezto:module:completion' loaded 1
|
||||||
|
|
||||||
# Colorize completions for commands unload, report, creinstall, cuninstall.
|
# Colorize completions for commands unload, report, creinstall, cuninstall.
|
||||||
|
|
@ -3224,9 +3234,9 @@ if [[ -e ${${ZINIT[BIN_DIR]}}/zmodules/Src/zdharma/zplugin.so ]] {
|
||||||
}
|
}
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# !atpull-pre.
|
# !atpull-pre
|
||||||
@zinit-register-hook "-r/--reset" hook:e-\!atpull-pre ∞zinit-reset-hook
|
@zinit-register-hook "-r/--reset" hook:e-\!atpull-pre ∞zinit-reset-hook
|
||||||
# !atpull-post.
|
# !atpull-post
|
||||||
@zinit-register-hook "ICE[reset]" hook:e-\!atpull-post ∞zinit-reset-hook
|
@zinit-register-hook "ICE[reset]" hook:e-\!atpull-post ∞zinit-reset-hook
|
||||||
@zinit-register-hook "atpull'!'" hook:e-\!atpull-post ∞zinit-atpull-e-hook
|
@zinit-register-hook "atpull'!'" hook:e-\!atpull-post ∞zinit-atpull-e-hook
|
||||||
|
|
||||||
|
|
@ -3261,10 +3271,10 @@ if [[ -e ${${ZINIT[BIN_DIR]}}/zmodules/Src/zdharma/zplugin.so ]] {
|
||||||
# atclone-post.
|
# atclone-post.
|
||||||
@zinit-register-hook "compile-plugin" hook:atclone-post ∞zinit-compile-plugin-hook
|
@zinit-register-hook "compile-plugin" hook:atclone-post ∞zinit-compile-plugin-hook
|
||||||
|
|
||||||
# Create so that for sure no warncreateglobal warning is issued
|
# create so that for sure no warncreateglobal warning is issued
|
||||||
typeset -g REPLY
|
typeset -g REPLY
|
||||||
|
|
||||||
# A searchable menu of TAGS in current directory
|
# a searchable menu of tags for current directory
|
||||||
zinit null light-mode autoload'zi-browse-symbol' for %$ZINIT[BIN_DIR]
|
zinit null light-mode autoload'zi-browse-symbol' for %$ZINIT[BIN_DIR]
|
||||||
zle -N zi-browse-symbol
|
zle -N zi-browse-symbol
|
||||||
zle -N zi-browse-symbol-backwards zi-browse-symbol
|
zle -N zi-browse-symbol-backwards zi-browse-symbol
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue