1
0

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

This commit is contained in:
Konstantin Demin 2024-02-23 21:46:04 +03:00
parent 0289d90fb9
commit 47b2170058
Signed by: krd
GPG Key ID: 1F33CB0BA4731BC6
14 changed files with 72 additions and 53 deletions

0
.cache/zsh/compzwc/.keep Normal file
View File

View File

@ -1,6 +1,7 @@
* *
!/.cache/zsh/compcache/.keep !/.cache/zsh/compcache/.keep
!/.cache/zsh/completion/.keep !/.cache/zsh/completion/.keep
!/.cache/zsh/compzwc/.keep
!/.config/dotfiles/bin/.keep !/.config/dotfiles/bin/.keep
!/.config/dotfiles/gen-gitignore.sh !/.config/dotfiles/gen-gitignore.sh
!/.config/dotfiles/gitignore !/.config/dotfiles/gitignore
@ -56,6 +57,7 @@
!/.config/zsh/lib/title.zsh !/.config/zsh/lib/title.zsh
!/.config/zsh/local.zsh.example !/.config/zsh/local.zsh.example
!/.config/zsh/local/.keep !/.config/zsh/local/.keep
!/.config/zsh/local/completion/.keep
!/.config/zsh/opt.zsh !/.config/zsh/opt.zsh
!/.config/zsh/opt/chase.zsh !/.config/zsh/opt/chase.zsh
!/.config/zsh/opt/completion.zsh !/.config/zsh/opt/completion.zsh

View File

@ -32,3 +32,7 @@ steps:
: # try shellcheck (except for *.zsh) : # try shellcheck (except for *.zsh)
git ls-files | grep -Fv '.zsh' | sort -uV | xargs -r file -N -i | grep text/x-shellscript | cut -d: -f1 \ git ls-files | grep -Fv '.zsh' | sort -uV | xargs -r file -N -i | grep text/x-shellscript | cut -d: -f1 \
| xargs -r -n1 shellcheck | xargs -r -n1 shellcheck
## personal tweaks :)
labels:
network: dmz

View File

@ -15,11 +15,6 @@ ZSHU[d_var]="${ZSHU[d_conf]}/var"
ZSHU[d_bin]="${ZDOTDIR}/.config/dotfiles/bin" ZSHU[d_bin]="${ZDOTDIR}/.config/dotfiles/bin"
ZSHU[d_scripts]="${ZDOTDIR}/.config/dotfiles/scripts" ZSHU[d_scripts]="${ZDOTDIR}/.config/dotfiles/scripts"
for i ( d_zdot d_cache d_conf d_bin d_scripts d_var ) ; do
d=${ZSHU[$i]}
[ -d "$d" ] || mkdir -p "$d"
done ; unset i d
## early escape ## early escape
unsetopt global_rcs unsetopt global_rcs
@ -45,10 +40,10 @@ done ; unset n f
for n ( ${zshu_parts} ) ; do for n ( ${zshu_parts} ) ; do
d="${ZSHU[d_conf]}/$n" d="${ZSHU[d_conf]}/$n"
[ -d "$d" ] || continue [ -d "$d" ] || continue
for i ( $d/*.zsh(N.r) ) ; do for i ( "$d"/*.zsh(N.r) ) ; do
source "$i" source "$i"
done ; unset i done
done ; unset n d done ; unset i n d
unset zshu_parts unset zshu_parts

View File

@ -2,23 +2,29 @@
alias bud='buildah bud --isolation chroot --network host --format docker -f ' alias bud='buildah bud --isolation chroot --network host --format docker -f '
alias pod-run='podman run -e "TERM=${TERM:-linux}" --network host --rm -it ' alias pod-run='podman run -e "TERM=${TERM:-linux}" --rm -it '
alias pod-run-sh="pod-run --entrypoint='[\"/bin/sh\"]' --user=0:0 " alias pod-run-sh="pod-run --network host --entrypoint='[\"/bin/sh\"]' --user=0:0 "
alias pod-ps='podman ps ' alias pod-ps='podman ps '
alias pod-images='podman images --format "table {{.ID}} {{.Repository}}:{{.Tag}} {{.Size}} {{.Created}} |{{.CreatedAt}}" ' alias pod-images='podman images --format "table {{.ID}} {{.Repository}}:{{.Tag}} {{.Size}} {{.Created}} |{{.CreatedAt}}" '
alias pod-inspect='podman inspect ' alias pod-inspect='podman inspect '
alias pod-logs='podman logs ' alias pod-logs='podman logs '
sko-inspect() { sko-inspect() {
command skopeo inspect "docker://${1:?}" local i
i="${1:?}" ; shift
command skopeo inspect "docker://$i" "$@"
} }
sko-list-tags() { sko-list-tags() {
command skopeo list-tags "docker://${1:?}" local i
i="${1:?}" ; shift
command skopeo list-tags "docker://$i" "$@"
} }
pod-dive() { pod-dive() {
command dive "podman://${1:?}" local i
i="${1:?}" ; shift
command dive "podman://$i" "$@"
} }
jq-visual() { jq-visual() {

View File

@ -5,7 +5,7 @@ function {
local -a p local -a p
local -aU t npath games local -aU t npath games
p=( $path ) p=( ${path} )
## strip "games" first :) ## strip "games" first :)
t=( ${(@)p:#*games*} ) t=( ${(@)p:#*games*} )
@ -36,9 +36,9 @@ function {
## finally... games! xD ## finally... games! xD
npath+=( /usr/local/games /usr/games ) npath+=( /usr/local/games /usr/games )
npath+=( $games ) npath+=( ${games} )
path=( $npath ) path=( ${npath} )
hash -f hash -f
} }

View File

@ -3,10 +3,12 @@
typeset -gA ZSHU_COMP_FORCE typeset -gA ZSHU_COMP_FORCE
ZSHU[f_compdump]="${ZSHU[d_cache]}/compdump" 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" 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}" ; } __z_compdump_print() { printf '#zshu %s %s\n' "$1" "${(P)1}" ; }
@ -73,17 +75,19 @@ __z_comp_external() {
(( ${+commands[$c]} )) || return 2 (( ${+commands[$c]} )) || return 2
if ! (( ${+ZSHU_COMP_FORCE[$c]} )) ; then if ! (( ${+ZSHU_COMP_FORCE[$c]} )) ; then
(( ${+_comps[$c]} )) && return (( ${+_comps[$c]} )) && return 0
fi fi
f="${ZSHU[d_cache]}/completion/_$c" f="${ZSHU[d_completion]}/_$c"
if ! [ -s "$f" ] ; then if ! [ -s "$f" ] ; then
if ! "$@" > "$f" ; then if ! "$@" > "$f" ; then
rm -f "$f" rm -f "$f"
return 3 return 3
fi fi
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" autoload -Uz "_$c"
return 0 return 0
@ -95,30 +99,34 @@ __z_comp_system() {
(( ${+commands[$1]} )) || return 1 (( ${+commands[$1]} )) || return 1
(( ${+_comps[$1]} )) && return 2 (( ${+_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 [ -s "$d/_$1" ] || continue
# emulate zsh -c "autoload -Uz _$1"
autoload -Uz "_$1" autoload -Uz "_$1"
fpath=( ${_fpath} )
return 0 return 0
done done
fpath=( ${_fpath} )
return 3 return 3
} }
## reload or new session are required to regenerate compcache ## reload or new session are required to regenerate compcache
z-comp-invalidate() { z-comp-invalidate() {
local f
[ -n "$1" ] || return 1 [ -n "$1" ] || return 1
f="${ZSHU[d_cache]}/completion/_$1" # rm -f "${ZSHU[d_completion]}/_$1" "${ZSHU[d_compzwc]}/_$1.zwc" "${ZSHU[d_compzwc]}/$1.zwc"
rm -f "$f.zwc" rm -f "${ZSHU[d_completion]}/_$1"
[ -f "$f" ] || return 2
rm -f "$f"
} }
## reload or new session are required to regenerate completions ## reload or new session are required to regenerate completions
z-comp-flush() { 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() { z-comp-auto() {

View File

@ -31,10 +31,7 @@ z-git-test() {
__z_git_pwd() { __z_git_pwd() {
local x local x
unset 'ZSHU_PS[git_ref]' 'ZSHU_PS[git_changes]' 'ZSHU_PS[git_tag]' 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]'
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]'
z-git-test || return z-git-test || return

View File

@ -4,7 +4,7 @@ z-history() {
local list local list
zparseopts -E l=list zparseopts -E l=list
if [[ -n "$list" ]]; then if [ -n "${list}" ]; then
builtin fc "$@" builtin fc "$@"
else else
[[ ${@[-1]-} = *[0-9]* ]] && builtin fc -il "$@" || builtin fc -il "$@" 1 [[ ${@[-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 for i ( "${ZSHU[d_conf]}"/**/*.zsh(N.r) ) ; do
zcompile -UR "$i" zcompile -UR "$i"
done done
for i ( "${ZSHU[d_cache]}/completion"/*(N.r) ) ; do # for i ( "${ZSHU[d_completion]}"/*(N.r) ) ; do
case "$i" in # case "$i" in
*.zwc ) continue ;; # *.zwc )
esac # # likely a remnant
zcompile -zUR "$i" # rm -f "$i"
done # continue
# ;;
# esac
# zcompile -UR "$i"
# mv -f "$i.zwc" "${ZSHU[d_compzwc]}/"
# done
} }
z-zwc-flush() { z-zwc-flush() {
@ -30,8 +35,7 @@ z-zwc-flush() {
z-update() { z-update() {
dotfiles-update dotfiles-update
z-zwc-flush z-cache-flush
z-zwc-gen
} }
z-reload() { z-reload() {
@ -42,7 +46,7 @@ z-reload() {
## reload or new session are required to regenerate compcache ## reload or new session are required to regenerate compcache
z-cache-flush() { 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-flush
z-zwc-gen z-zwc-gen
} }

View File

View File

@ -17,9 +17,12 @@ zshu_modules+=(
zutil zutil
) )
for i ( ${zshu_modules} ) ; do for i ( ${zshu_modules} ) ; do
[[ "$i" != */* ]] && i="zsh/$i" case "$i" in
zmodload -i $i */* ) ;;
done ; unset i * ) i="zsh/$i" ;;
unset zshu_modules esac
zmodload -i "$i"
done
unset i zshu_modules
autoload -Uz +X colors && colors autoload -Uz +X colors && colors

View File

@ -19,9 +19,9 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir
zstyle ':completion:*:*:*:users' ignored-patterns adm amanda apache at avahi avahi-autoipd backup beaglidx bin bind cacti canna clamav colord daemon dbus distcache dnsmasq dovecot fax ftp games gdm gkrellmd gnats gopher hacluster haldaemon halt hplip hsqldb ident irc junkbust kdm ldap list lp mail mailman mailnull man messagebus mldonkey mysql nagios named netdump news nfsnobody nginx nobody nscd ntp ntpsec nut nx obsrun openvpn operator pcap polkitd postfix postgres privoxy proxy pulse pvm quagga radvd redsocks rpc rpcuser rpm rtkit saned sbuild sbws scard sddm shutdown speech-dispatcher squid sshd statd svn sync sys tcpdump tftp tss usbmux uucp uuidd vcsa wwwrun www-data x2gouser xfs '_*' 'systemd-*' 'debian-*' 'Debian-*' zstyle ':completion:*:*:*:users' ignored-patterns adm amanda apache at avahi avahi-autoipd backup beaglidx bin bind cacti canna clamav colord daemon dbus distcache dnsmasq dovecot fax ftp games gdm gkrellmd gnats gopher hacluster haldaemon halt hplip hsqldb ident irc junkbust kdm ldap list lp mail mailman mailnull man messagebus mldonkey mysql nagios named netdump news nfsnobody nginx nobody nscd ntp ntpsec nut nx obsrun openvpn operator pcap polkitd postfix postgres privoxy proxy pulse pvm quagga radvd redsocks rpc rpcuser rpm rtkit saned sbuild sbws scard sddm shutdown speech-dispatcher squid sshd statd svn sync sys tcpdump tftp tss usbmux uucp uuidd vcsa wwwrun www-data x2gouser xfs '_*' 'systemd-*' 'debian-*' 'Debian-*'
zstyle '*' single-ignored show zstyle '*' single-ignored show
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w" zstyle ':completion:*:*:*:*:processes' command "ps -u ${USER} -o pid,user,comm -w -w"
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' zstyle ':completion:*:kill:*' command 'ps -u ${USER} -o pid,%cpu,tty,cputime,cmd'
if autoload -Uz +X bashcompinit ; then if autoload -Uz +X bashcompinit ; then
bashcompinit && ZSHU[compdump_bash]=1 bashcompinit && ZSHU[compdump_bash]=1
@ -30,10 +30,10 @@ fi
autoload -Uz +X compinit && \ autoload -Uz +X compinit && \
compinit -i -C -d "${ZSHU[f_compdump]}" compinit -i -C -d "${ZSHU[f_compdump]}"
for i ( ${ZSHU[d_conf]}/completion/*.zsh(N.r) ) ; do for i ( "${ZSHU[d_conf]}"/completion/*.zsh(N.r) ) ; do
source "$i" source "$i"
done ; unset i done ; unset i
for i ( ${ZSHU[d_conf]}/local/completion/*.zsh(N.r) ) ; do for i ( "${ZSHU[d_conf]}"/local/completion/*.zsh(N.r) ) ; do
source "$i" source "$i"
done ; unset i done ; unset i

View File

@ -134,5 +134,5 @@ bindkey -e
for i ( /usr/share/doc/fzf/examples/key-bindings.zsh ) ; do for i ( /usr/share/doc/fzf/examples/key-bindings.zsh ) ; do
[ -s "$i" ] || continue [ -s "$i" ] || continue
source "$i" source $i
done ; unset i done ; unset i