1
0

zsh: update
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2024-02-23 21:46:04 +03:00
parent 0289d90fb9
commit 47b2170058
14 changed files with 72 additions and 53 deletions

View File

@@ -3,10 +3,12 @@
typeset -gA ZSHU_COMP_FORCE
ZSHU[f_compdump]="${ZSHU[d_cache]}/compdump"
ZSHU[d_completion]="${ZSHU[d_cache]}/completion"
ZSHU[d_compzwc]="${ZSHU[d_cache]}/compzwc"
ZSHU[d_compcache]="${ZSHU[d_cache]}/compcache"
[ -d "${ZSHU[d_compcache]}" ] || mkdir -p "${ZSHU[d_compcache]}"
fpath=( "${ZSHU[d_cache]}/completion" $fpath )
typeset -a ZSHU_SYS_FPATH=( ${fpath} )
fpath=( "${ZSHU[d_compzwc]}" "${ZSHU[d_completion]}" ${fpath} )
__z_compdump_print() { printf '#zshu %s %s\n' "$1" "${(P)1}" ; }
@@ -73,17 +75,19 @@ __z_comp_external() {
(( ${+commands[$c]} )) || return 2
if ! (( ${+ZSHU_COMP_FORCE[$c]} )) ; then
(( ${+_comps[$c]} )) && return
(( ${+_comps[$c]} )) && return 0
fi
f="${ZSHU[d_cache]}/completion/_$c"
f="${ZSHU[d_completion]}/_$c"
if ! [ -s "$f" ] ; then
if ! "$@" > "$f" ; then
rm -f "$f"
return 3
fi
fi
zcompile -zUR "$f" || return 4
# zcompile -zR "$f"
# mv -f "$f.zwc" "${ZSHU[d_compzwc]}/$c.zwc"
# emulate zsh -c "autoload -Uz _$c"
autoload -Uz "_$c"
return 0
@@ -95,30 +99,34 @@ __z_comp_system() {
(( ${+commands[$1]} )) || return 1
(( ${+_comps[$1]} )) && return 2
for d ( $fpath ) ; do
(( ${+ZSHU_COMP_FORCE[$c]} )) && return 0
local -a _fpath
_fpath=( ${fpath} )
fpath=( ${ZSHU_SYS_FPATH} )
for d ( ${fpath} ) ; do
[ -s "$d/_$1" ] || continue
# emulate zsh -c "autoload -Uz _$1"
autoload -Uz "_$1"
fpath=( ${_fpath} )
return 0
done
fpath=( ${_fpath} )
return 3
}
## reload or new session are required to regenerate compcache
z-comp-invalidate() {
local f
[ -n "$1" ] || return 1
f="${ZSHU[d_cache]}/completion/_$1"
rm -f "$f.zwc"
[ -f "$f" ] || return 2
rm -f "$f"
# rm -f "${ZSHU[d_completion]}/_$1" "${ZSHU[d_compzwc]}/_$1.zwc" "${ZSHU[d_compzwc]}/$1.zwc"
rm -f "${ZSHU[d_completion]}/_$1"
}
## reload or new session are required to regenerate completions
z-comp-flush() {
find "${ZSHU[d_cache]}/completion/" -xdev -type f '!' -name '.keep' -delete
find "${ZSHU[d_completion]}/" "${ZSHU[d_compzwc]}/" -xdev -type f '!' -name '.keep' -delete
}
z-comp-auto() {

View File

@@ -31,10 +31,7 @@ z-git-test() {
__z_git_pwd() {
local x
unset 'ZSHU_PS[git_ref]' 'ZSHU_PS[git_changes]' 'ZSHU_PS[git_tag]'
unset 'ZSHU_GIT[path_root]' 'ZSHU_GIT[path_mid]' 'ZSHU_GIT[path_last]'
unset 'ZSHU_GIT[commit]' 'ZSHU_GIT[detached]' 'ZSHU_GIT[ref]' 'ZSHU_GIT[remote]' 'ZSHU_GIT[tag]'
unset 'ZSHU_GIT[ref_behind]' 'ZSHU_GIT[ref_ahead]' 'ZSHU_GIT[ref_changes]'
unset 'ZSHU_PS[git_ref]' 'ZSHU_PS[git_changes]' 'ZSHU_PS[git_tag]' 'ZSHU_GIT[path_root]' 'ZSHU_GIT[path_mid]' 'ZSHU_GIT[path_last]' 'ZSHU_GIT[commit]' 'ZSHU_GIT[detached]' 'ZSHU_GIT[ref]' 'ZSHU_GIT[remote]' 'ZSHU_GIT[tag]' 'ZSHU_GIT[ref_behind]' 'ZSHU_GIT[ref_ahead]' 'ZSHU_GIT[ref_changes]'
z-git-test || return

View File

@@ -4,7 +4,7 @@ z-history() {
local list
zparseopts -E l=list
if [[ -n "$list" ]]; then
if [ -n "${list}" ]; then
builtin fc "$@"
else
[[ ${@[-1]-} = *[0-9]* ]] && builtin fc -il "$@" || builtin fc -il "$@" 1

View File

@@ -16,12 +16,17 @@ z-zwc-gen() {
for i ( "${ZSHU[d_conf]}"/**/*.zsh(N.r) ) ; do
zcompile -UR "$i"
done
for i ( "${ZSHU[d_cache]}/completion"/*(N.r) ) ; do
case "$i" in
*.zwc ) continue ;;
esac
zcompile -zUR "$i"
done
# for i ( "${ZSHU[d_completion]}"/*(N.r) ) ; do
# case "$i" in
# *.zwc )
# # likely a remnant
# rm -f "$i"
# continue
# ;;
# esac
# zcompile -UR "$i"
# mv -f "$i.zwc" "${ZSHU[d_compzwc]}/"
# done
}
z-zwc-flush() {
@@ -30,8 +35,7 @@ z-zwc-flush() {
z-update() {
dotfiles-update
z-zwc-flush
z-zwc-gen
z-cache-flush
}
z-reload() {
@@ -42,7 +46,7 @@ z-reload() {
## reload or new session are required to regenerate compcache
z-cache-flush() {
find "${ZSHU[d_cache]}/" "${ZSHU[d_compcache]}/" -xdev -type f '!' -name '.keep' -delete
find "${ZSHU[d_cache]}/" -xdev -type f '!' -name '.keep' -delete
z-zwc-flush
z-zwc-gen
}