Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/lint #13

Merged
merged 2 commits into from
Nov 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 36 additions & 36 deletions lib/zsh/autoload.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ ZINIT[EXTENDED_GLOB]=""

local i
for i in "${filtered[@]}"; do
[[ "$i" = "_local/zinit" ]] && continue
[[ "$i" = "_local/zi" ]] && continue
.zinit-any-colorify-as-uspl2 "$i"
# Mark light loads
[[ "${ZINIT[STATES__$i]}" = "1" ]] && REPLY="$REPLY ${ZINIT[col-info]}*${ZINIT[col-rst]}"
Expand Down Expand Up @@ -1403,7 +1403,7 @@ ZINIT[EXTENDED_GLOB]=""
.zinit-show-all-reports() {
local i
for i in "${ZINIT_REGISTERED_PLUGINS[@]}"; do
[[ "$i" = "_local/zinit" ]] && continue
[[ "$i" = "_local/zi" ]] && continue
.zinit-show-report "$i"
done
} # ]]]
Expand Down Expand Up @@ -1894,7 +1894,7 @@ ZINIT[EXTENDED_GLOB]=""
pd=${repo:t}

# Two special cases
[[ $pd = custom || $pd = _local---zinit ]] && continue
[[ $pd = custom || $pd = _local---zi ]] && continue

.zinit-any-colorify-as-uspl2 "$pd"

Expand Down Expand Up @@ -1987,7 +1987,7 @@ ZINIT[EXTENDED_GLOB]=""
for repo ( $files ) {
uspl=${repo:t}
# Two special cases
[[ $uspl = custom || $uspl = _local---zinit ]] && continue
[[ $uspl = custom || $uspl = _local---zi ]] && continue

# Check if repository has a remote set
if [[ -f $repo/.git/config ]] {
Expand Down Expand Up @@ -2073,7 +2073,7 @@ ZINIT[EXTENDED_GLOB]=""
+zinit-message "Plugin directory: {file}${ZINIT[PLUGINS_DIR]}{rst}"
+zinit-message "Completions directory: {file}${ZINIT[COMPLETIONS_DIR]}{rst}"

# Without _zlocal/zinit
# Without _zlocal/zi
+zinit-message "Loaded plugins: {num}$(( ${#ZINIT_REGISTERED_PLUGINS[@]} - 1 )){rst}"

# Count light-loaded plugins
Expand All @@ -2082,20 +2082,20 @@ ZINIT[EXTENDED_GLOB]=""
for s in "${(@v)ZINIT[(I)STATES__*]}"; do
[[ "$s" = 1 ]] && (( light ++ ))
done
# Without _zlocal/zinit
# Without _zlocal/zi
+zinit-message "Light loaded: {num}$(( light - 1 )){rst}"

# Downloaded plugins, without _zlocal/zinit, custom
# Downloaded plugins, without _zlocal/zi, custom
typeset -a plugins
plugins=( "${ZINIT[PLUGINS_DIR]}"/*(DN) )
+zinit-message "Downloaded plugins: {num}$(( ${#plugins} - 1 )){rst}"

# Number of enabled completions, with _zlocal/zinit
# Number of enabled completions, with _zlocal/zi
typeset -a completions
completions=( "${ZINIT[COMPLETIONS_DIR]}"/_[^_.]*~*.zwc(DN) )
+zinit-message "Enabled completions: {num}${#completions[@]}{rst}"

# Number of disabled completions, with _zlocal/zinit
# Number of disabled completions, with _zlocal/zi
completions=( "${ZINIT[COMPLETIONS_DIR]}"/[^_.]*~*.zwc(DN) )
+zinit-message "Disabled completions: {num}${#completions[@]}{rst}"

Expand Down Expand Up @@ -2296,7 +2296,7 @@ ZINIT[EXTENDED_GLOB]=""

local p user plugin
for p in "${plugins[@]}"; do
[[ "${p:t}" = "custom" || "${p:t}" = "_local---zinit" ]] && continue
[[ "${p:t}" = "custom" || "${p:t}" = "_local---zi" ]] && continue

.zinit-any-to-user-plugin "${p:t}"
user="${reply[-2]}" plugin="${reply[-1]}"
Expand Down Expand Up @@ -2904,7 +2904,7 @@ builtin print -Pr \"\$ZINIT[col-obj]Done (with the exit code: \$_retval).%f%b\""
local p uspl1
for p in ${plugins[@]}; do
uspl1=${p:t}
[[ $uspl1 = custom || $uspl1 = _local---zinit ]] && continue
[[ $uspl1 = custom || $uspl1 = _local---zi ]] && continue

pushd "$p" >/dev/null || continue
if [[ -d .git ]]; then
Expand Down Expand Up @@ -3332,31 +3332,31 @@ EOF
setopt localoptions localtraps
trap 'return 1' INT TERM
( builtin cd -q "${ZINIT[BIN_DIR]}"/zmodules
+zinit-message "{pname}== Building module zshell/zplugin, running: make clean, then ./configure and then make =={rst}"
+zinit-message "{pname}== The module sources are located at: "${ZINIT[BIN_DIR]}"/zmodules =={rst}"
if [[ -f Makefile ]] {
if [[ "$1" = "--clean" ]] {
noglob +zinit-message {p}-- make distclean --{rst}
make distclean
((1))
} else {
noglob +zinit-message {p}-- make clean --{rst}
make clean
}
}
noglob +zinit-message {p}-- ./configure --{rst}
CPPFLAGS=-I/usr/local/include CFLAGS="-g -Wall -O3" LDFLAGS=-L/usr/local/lib ./configure --disable-gdbm --without-tcsetpgrp && {
noglob +zinit-message {p}-- make --{rst}
if { make } {
[[ -f Src/zshell/zplugin.so ]] && cp -vf Src/zshell/zplugin.{so,bundle}
noglob +zinit-message "{info}Module has been built correctly.{rst}"
.zinit-module info
} else {
noglob +zinit-message "{error}Module didn't build.{rst} "
.zinit-module info --link
}
}
builtin print $EPOCHSECONDS >! "${ZINIT[BIN_DIR]}"/zmodules/COMPILED_AT
+zinit-message "{pname}== Building module zshell/zplugin, running: make clean, then ./configure and then make =={rst}"
+zinit-message "{pname}== The module sources are located at: "${ZINIT[BIN_DIR]}"/zmodules =={rst}"
if [[ -f Makefile ]] {
if [[ "$1" = "--clean" ]] {
noglob +zinit-message {p}-- make distclean --{rst}
make distclean
((1))
} else {
noglob +zinit-message {p}-- make clean --{rst}
make clean
}
}
noglob +zinit-message {p}-- ./configure --{rst}
CPPFLAGS=-I/usr/local/include CFLAGS="-g -Wall -O3" LDFLAGS=-L/usr/local/lib ./configure --disable-gdbm --without-tcsetpgrp && {
noglob +zinit-message {p}-- make --{rst}
if { make } {
[[ -f Src/zshell/zplugin.so ]] && cp -vf Src/zshell/zplugin.{so,bundle}
noglob +zinit-message "{info}Module has been built correctly.{rst}"
.zinit-module info
} else {
noglob +zinit-message "{error}Module didn't build.{rst} "
.zinit-module info --link
}
}
builtin print $EPOCHSECONDS >! "${ZINIT[BIN_DIR]}"/zmodules/COMPILED_AT
)
}
# ]]]
Expand Down
32 changes: 10 additions & 22 deletions zi.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2006,8 +2006,8 @@ ${match[4]:+${${match[3]:-$ZINIT[col-${ZINIT[__last-formatter-code]}]}:#%F}}$mat
${${functions[.zinit-formatter-$match[7]]:+\
${$(.zinit-formatter-$match[7] "$match[8]"; builtin print -rn -- $REPLY):-←→}}:-\
$(.zinit-main-message-formatter "$match[6]" "$match[7]" "$match[8]"; \
builtin print -rn -- "$REPLY"
)${${ZINIT[__last-formatter-code]::=${${${match[7]:#(…|ndsh|mdsh|mmdsh|-…|lr)}:+\
builtin print -rn -- "$REPLY"
)${${ZINIT[__last-formatter-code]::=${${${match[7]:#(…|ndsh|mdsh|mmdsh|-…|lr)}:+\
$match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}

# Restore the default color at the end of the message.
Expand Down Expand Up @@ -2375,7 +2375,7 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
# FUNCTION: zi. [[[
# Main function directly exposed to user, obtains subcommand and its
# arguments, has completion.
zi() {
zinit() {
local -A ICE ZINIT_ICE
ICE=( "${(kv)ZINIT_ICES[@]}" )
ZINIT_ICE=( "${(kv)ICE[@]}" )
Expand Down Expand Up @@ -2428,8 +2428,7 @@ zi() {
-x opt_-x,--command:"Load the snippet as a {cmd}command{rst}, i.e.: add it to {var}\$PATH{rst} and set {b-lhi}+x{rst} on it."
--command opt_-x,--command
env-whitelist "-h|--help|-v|--verbose"
update "-L|--plugins|-s|--snippets|-p|--parallel|-a|--all|\
-q|--quiet|-r|--reset|-u|--urge|-n|--no-pager|-v|--verbose|-h|--help"
update "-L|--plugins|-s|--snippets|-p|--parallel|-a|--all|-q|--quiet|-r|--reset|-u|--urge|-n|--no-pager|-v|--verbose|-h|--help"
delete "-a|--all|-c|--clean|-y|--yes|-q|--quiet|-h|--help"
unload "-h|--help|-q|--quiet"
cdclear "-h|--help|-q|--quiet"
Expand Down Expand Up @@ -2514,42 +2513,34 @@ env-whitelist|bindkeys|module|add-fpath|fpath|run${reply:+|${(~j:|:)"${reply[@]#
ZINIT_ICE=( "${(kv)ICE[@]}" ) ZINIT_ICES=()
integer ___msgs=${+ICE[debug]}
(( ___msgs )) && +zinit-message "{pre}zinit-main:{faint} Processing {pname}$1{faint}{…}{rst}"

# Delete up to the final space to get the previously-processed ID.
ZINIT[annex-exposed-processed-IDs]+="${___id:+ $___id}"

# Strip the ID-qualifier (`@') and GitHub domain from the ID.
___id="${${1#@}%%(///|//|/)}"
(( ___is_snippet == -1 )) && ___id="${___id#/~https://github.com/}"

# Effective handle-ID – the label under which the object
# will be identified / referred-to by ZI.
___ehid="${ICE[id-as]:-$___id}"

# Effective remote-ID (i.e.: URL, GitHub username/repo,
# package name, etc.). teleid'' allows "overriding" of $1.
# In case of a package using teleid'', the value here
# is being took from the given ices, before disk-ices.
___etid="${ICE[teleid]:-$___id}"

if (( ${+ICE[pack]} )); then
___had_wait=${+ICE[wait]}
.zinit-load-ices "$___ehid"
# wait'' isn't possible via the disk-ices (for
# packages), only via the command's ice-spec.
[[ $___had_wait -eq 0 ]] && unset 'ICE[wait]'
fi

[[ ${ICE[id-as]} = (auto|) && ${+ICE[id-as]} == 1 ]] && ICE[id-as]="${___etid:t}"

integer ___is_snippet=${${(M)___is_snippet:#-1}:-0}
() {
builtin setopt localoptions extendedglob
if [[ $___is_snippet -ge 0 && ( -n ${ICE[is-snippet]+1} || $___etid = ((#i)(http(s|)|ftp(s|)):/|(${(~kj.|.)ZINIT_1MAP}))* ) ]] {
___is_snippet=1
}
} "$@"

local ___type=${${${(M)___is_snippet:#1}:+snippet}:-plugin}
reply=(
${(on)ZINIT_EXTS2[(I)zinit hook:before-load-pre <->]}
Expand All @@ -2573,7 +2564,6 @@ env-whitelist|bindkeys|module|add-fpath|fpath|run${reply:+|${(~j:|:)"${reply[@]#
___args=( "${(@Q)${(@z)ZINIT[annex-before-load:new-@]}}" )
builtin set -- "${___args[@]}"
}

# Override $___ices?
if (( ___retval2 & 4 )) {
local -a ___new_ices
Expand Down Expand Up @@ -3009,9 +2999,8 @@ zicompdef() { ZINIT_COMPDEF_REPLAY+=( "${(j: :)${(q)@}}" ); }
${${${(@M)${@#\!}:#*(->|=>|→)*}}:+-C} ${${@#\!}:+-C}
}
# ]]]

# Compatibility functions. [[[
zplugin() { zinit "$@"; }
zplugin() { zi "$@"; }
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]}}"; }
Expand All @@ -3035,8 +3024,7 @@ zmodload zsh/zpty zsh/system 2>/dev/null
zmodload -F zsh/stat b:zstat 2>/dev/null && ZINIT[HAVE_ZSTAT]=1

# code. [[[
builtin alias zpl=zi zplg=zi zini=zi zinit=zi

builtin alias zi=zinit zpl=zinit zplg=zinit zini=zinit
.zinit-prepare-home

# Remember source's timestamps for the automatic-reload feature.
Expand All @@ -3054,10 +3042,10 @@ ZINIT[STATES___local/zi]=1
zstyle ':prezto:module:completion' loaded 1

# Colorize completions for commands unload, report, creinstall, cuninstall.
zstyle ':completion:*:zinit:argument-rest:plugins' list-colors '=(#b)(*)/(*)==1;35=1;33'
zstyle ':completion:*:zinit:argument-rest:plugins' matcher 'r:|=** l:|=*'
zstyle ':completion:*:*:zinit:*' group-name ""
zstyle ':completion:*:zi:argument-rest:plugins' list-colors '=(#b)(*)/(*)==1;35=1;33'
#zstyle ':completion:*:zinit:argument-rest:plugins' list-colors '=(#b)(*)/(*)==1;35=1;33'
#zstyle ':completion:*:zinit:argument-rest:plugins' matcher 'r:|=** l:|=*'
#zstyle ':completion:*:*:zinit:*' group-name ""
zstyle ':completion:*:zi:argument-rest:plugins' list-colors '=(#b)(*)/(*)==1;36=4;35'
zstyle ':completion:*:zi:argument-rest:plugins' matcher 'r:|=** l:|=*'
zstyle ':completion:*:*:zi:*' group-name ""
# ]]]
Expand Down