From 5d0f163ea0982a4fc3919553b43a3604640580c7 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 10:02:25 +0000 Subject: [PATCH 01/38] +comps|autoload-lint --- .gitignore | 3 + lib/_zi | 466 +++++++++++------------ lib/zsh/autoload.zsh | 877 +++++++++++++++++++++---------------------- 3 files changed, 644 insertions(+), 702 deletions(-) diff --git a/.gitignore b/.gitignore index c373c4a1..40476bf5 100644 --- a/.gitignore +++ b/.gitignore @@ -189,3 +189,6 @@ zmodules/Test/*.tmp /zmodules/cscope.out /zmodules/stamp-h /zmodules/autom4te.cache +NEWS.md +.gitignore +Untitled-1.sh diff --git a/lib/_zi b/lib/_zi index 47ee1e00..23e790b5 100755 --- a/lib/_zi +++ b/lib/_zi @@ -61,9 +61,7 @@ commands=( add-fpath:'Add plugin folder to $fpath' ) -_arguments -C \ - '1: :->command'\ - '*: :->argument' && ret=0 +_arguments -C '1: :->command''*: :->argument' && ret=0 case $state in command) @@ -73,7 +71,7 @@ case $state in case $words[2] in help) _message "Hit enter to get usage information" && ret=0 - ;; + ;; control) _message "Hit enter to get commands list" && ret=0 ;; @@ -81,248 +79,224 @@ case $state in _message "Hit enter to show commands for stats" && ret=0 ;; man) - _message "Hit enter to view manual" && ret=0 - ;; - zstatus) - _message "Hit enter to get overall status information" && ret=0 - ;; - times) - _message "Hit enter to get plugin load time statistics" && ret=0 - ;; - load|light) - typeset -a plugins - plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) - plugins=( "${plugins[@]//---//}" ) - plugins=( "${plugins[@]:#_local/zi}" ) - plugins=( "${plugins[@]:#custom}" ) - _alternative \ - 'plugins:-- Plugin --:compadd -a - plugins' \ - 'directories:-- Directory --:_directories' && \ - ret=0 - ;; - run|add-fpath) - typeset -a plugins - plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) - plugins=( "${plugins[@]//---//}" ) - plugins=( "${plugins[@]:#_local/zi}" ) - plugins=( "${plugins[@]:#custom}" ) - local -a opts - if [[ $words[2] = run ]]; then - opts=( -l ) - else - opts=( -f --front ) - fi - _alternative \ - 'plugins:-- Plugin --:compadd -a - plugins' \ - 'directories:-- Directory --:_directories' \ - 'opts:-- Option --:compadd -a - opts' && \ - ret=0 - ;; - compile|stress|edit|glance|recall|update|status|cd|changes|delete) - # Plugins - typeset -a plugins - plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) - plugins=( "${plugins[@]//---//}" ) - plugins=( "${plugins[@]:#_local/zi}" ) - plugins=( "${plugins[@]:#custom}" ) - # Snippets - local -a snippets snippets_alreadyld - local sni - snippets=( "${ZI[SNIPPETS_DIR]}"/**/._zi(D/:h) ) - snippets=( ${snippets[@]#${ZI[SNIPPETS_DIR]}/} ) - snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} ) - snippets=( ${snippets[@]/--//} ) - for sni ( ${snippets[@]} ) { - if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then - snippets_alreadyld+=( $sni ) - snippets=( ${snippets[@]:#$sni} ) - fi - } - _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' \ - 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ - 'plugins:-- Plugin --:compadd -a - plugins' && \ - ret=0 - ;; - unload|report) - typeset -a plugins absolute normal - plugins=( "${ZI_REGISTERED_PLUGINS[@]:#_local/zi}" ) - normal=( "${plugins[@]:#%*}" ) - absolute=( "${(M)plugins[@]:#%*}" ) - absolute=( "${absolute[@]/\%\/\//%/}" ) - local hm="${HOME%/}" - absolute=( "${absolute[@]/$hm/HOME}" ) - plugins=( $normal $absolute ) - _wanted plugins expl "-- Plugin --" \ - compadd "$@" -a - plugins && \ - ret=0 - ;; - all-reports) - _message "Hit enter to get all reports (for all loaded plugins)" && ret=0 - ;; - loaded|list) - _message "Hit enter or give part of plugin name" && ret=0 - ;; - clist|completions) - _message "Hit enter to get list of completions" && ret=0 - ;; - cclear) - _message "Hit enter to clear stray and improper completions" && ret=0 - ;; - cdisable) - # Find enabled completions - typeset -a completions - completions=( "${ZI[COMPLETIONS_DIR]}"/_*(N:t) ) - completions=( "${completions[@]#_}" ) - _wanted plugins expl "-- Completion --" \ - compadd "$@" -a - completions && \ - ret=0 - ;; - cenable) - # Find disabled - typeset -a completions - completions=( "${ZI[COMPLETIONS_DIR]}"/[^_]*(N:t) ) - _wanted plugins expl "-- Completion --" \ - compadd "$@" -a - completions && \ - ret=0 - ;; - creinstall) - # Complete only plugins that have any completions - # We must iterate each plugin to check - # for completions that can be installed - typeset -a plugins completions - local p c user plugin - for p in "${ZI[PLUGINS_DIR]}"/*; do - completions=( "$p"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|_zsh_highlight*|/zsdoc/*)(DN) ) - for c in "${completions[@]}"; do - p="${p:t}" - user="${p%%---*}" - plugin="${p#*---}" - [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" - plugins+=( "${user:+$user/}$plugin" ) - break - done - done - _wanted plugins expl "-- Plugin --" \ - compadd "$@" -a - plugins && \ - ret=0 - ;; - cuninstall) - # We must iterate each plugin and check if - # it has completions that are installed - typeset -a plugins completions - local p c user plugin cfile bkpfile - for p in "${ZI[PLUGINS_DIR]}"/*; do - completions=( "$p"/**/_[^_.][^.]#(N) ) - for c in "${completions[@]}"; do - cfile="${c:t}" - bkpfile="${cfile#_}" - # Completion installed, either enabled or disabled? - if [[ -e "${ZI[COMPLETIONS_DIR]}"/"$cfile" || -e "${ZI[COMPLETIONS_DIR]}"/"$bkpfile" ]]; then - p="${p:t}" - user="${p%%---*}" - plugin="${p#*---}" - [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" - plugins+=( "${user:+$user/}$plugin" ) - break - fi - done - done - _wanted plugins expl "-- Plugin --" \ - compadd "$@" -a - plugins && \ - ret=0 - ;; - compinit) - _message "Hit enter to refresh completion system" && ret=0 - ;; - snippet) - local -a snippets snippets_alreadyld - local sni - snippets=( "${ZI[SNIPPETS_DIR]}"/**/._zi(D/:h) ) - snippets=( ${snippets[@]#${ZI[SNIPPETS_DIR]}/} ) - snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} ) - snippets=( ${snippets[@]/--//} ) - for sni ( ${snippets[@]} ) { - if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then - snippets_alreadyld+=( $sni ) - snippets=( ${snippets[@]:#$sni} ) - fi - } - _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' \ - 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ - 'files:-- File --:_files' && \ - ret=0 - ;; - dstart|dtrace) - _message "Hit enter to start tracking this session" && ret=0 - ;; - dstop) - _message "Hit enter to stop tracking this session" && ret=0 - ;; - dunload) - _message "Hit enter to revert changes recorded between dstart and dstop" && ret=0 - ;; - dreport) - _message "Hit enter to show report of what was going on in session" && ret=0 - ;; - dclear) - _message "Hit enter to clear report of what was going on in session" && ret=0 - ;; - compile-all) - _message 'Hit enter to compile all downloaded plugins' && ret=0 - ;; - uncompile) - typeset -a plugins - plugins=( "${ZI[PLUGINS_DIR]}"/*(N) ) - typeset -a show_plugins p matches - for p in "${plugins[@]}"; do - matches=( $p/*.zwc(N) ) - if [ "$#matches" -ne "0" ]; then - p="${p:t}" - [ "$p" = "_local---zi" ] && continue - [ "$p" = "custom" ] && continue - p="${p//---//}" - show_plugins+=( "$p" ) - fi - done - _wanted show_plugins expl "-- Plugin --" \ - compadd "$@" -a - show_plugins && \ - ret=0 - ;; - uncompile-all) - _message 'Hit enter remove compiled versions of all downloaded plugins' && ret=0 - ;; - compiled) - _message 'Hit enter to get list of compiled plugins' && ret=0 - ;; - cdlist) - _message 'Hit enter to show compdef replay list' && ret=0 - ;; - cdreplay) - _message 'Hit enter to replay recorded compdefs' && ret=0 - ;; - cdclear) - _message 'Hit enter to clear compdef replay list' && ret=0 - ;; - recently) - typeset -a timespecs - timespecs=( - "3 days":"code modified during last 3 days" - "1 week":"code modified during last 7 days (default)" - "1 month":"code modified during last month" - ) - _describe -t timespecs "Time spec" timespecs && ret=0 - ;; - create) - _message 'Plugin spec or just enter, to create new plugin' && ret=0 - ;; - env-whitelist) - _wanted plugins expl "-- Parameter To White List During Any Plugin Unload --" \ - _parameters && ret=0 - ;; - *) - ret=1 - ;; - esac + _message "Hit enter to view manual" && ret=0 + ;; + zstatus) + _message "Hit enter to get overall status information" && ret=0 + ;; + times) + _message "Hit enter to get plugin load time statistics" && ret=0 + ;; + load|light) + typeset -a plugins + plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) + plugins=( "${plugins[@]//---//}" ) + plugins=( "${plugins[@]:#_local/zi}" ) + plugins=( "${plugins[@]:#custom}" ) + _alternative 'plugins:-- Plugin --:compadd -a - plugins' 'directories:-- Directory --:_directories' && ret=0 + ;; + run|add-fpath) + typeset -a plugins + plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) + plugins=( "${plugins[@]//---//}" ) + plugins=( "${plugins[@]:#_local/zi}" ) + plugins=( "${plugins[@]:#custom}" ) + local -a opts + if [[ $words[2] = run ]]; then + opts=( -l ) + else + opts=( -f --front ) + fi + _alternative 'plugins:-- Plugin --:compadd -a - plugins' 'directories:-- Directory --:_directories' 'opts:-- Option --:compadd -a - opts' && ret=0 + ;; + compile|stress|edit|glance|recall|update|status|cd|changes|delete) + # Plugins + typeset -a plugins + plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) + plugins=( "${plugins[@]//---//}" ) + plugins=( "${plugins[@]:#_local/zi}" ) + plugins=( "${plugins[@]:#custom}" ) + # Snippets + local -a snippets snippets_alreadyld + local sni + snippets=( "${ZI[SNIPPETS_DIR]}"/**/._zi(D/:h) ) + snippets=( ${snippets[@]#${ZI[SNIPPETS_DIR]}/} ) + snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} ) + snippets=( ${snippets[@]/--//} ) + for sni ( ${snippets[@]} ) { + if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then + snippets_alreadyld+=( $sni ) + snippets=( ${snippets[@]:#$sni} ) + fi + } + _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ + 'plugins:-- Plugin --:compadd -a - plugins' && ret=0 + ;; + unload|report) + typeset -a plugins absolute normal + plugins=( "${ZI_REGISTERED_PLUGINS[@]:#_local/zi}" ) + normal=( "${plugins[@]:#%*}" ) + absolute=( "${(M)plugins[@]:#%*}" ) + absolute=( "${absolute[@]/\%\/\//%/}" ) + local hm="${HOME%/}" + absolute=( "${absolute[@]/$hm/HOME}" ) + plugins=( $normal $absolute ) + _wanted plugins expl "-- Plugin --" compadd "$@" -a - plugins && ret=0 + ;; + all-reports) + _message "Hit enter to get all reports (for all loaded plugins)" && ret=0 + ;; + loaded|list) + _message "Hit enter or give part of plugin name" && ret=0 + ;; + clist|completions) + _message "Hit enter to get list of completions" && ret=0 + ;; + cclear) + _message "Hit enter to clear stray and improper completions" && ret=0 + ;; + cdisable) + # Find enabled completions + typeset -a completions + completions=( "${ZI[COMPLETIONS_DIR]}"/_*(N:t) ) + completions=( "${completions[@]#_}" ) + _wanted plugins expl "-- Completion --" compadd "$@" -a - completions && ret=0 + ;; + cenable) + # Find disabled + typeset -a completions + completions=( "${ZI[COMPLETIONS_DIR]}"/[^_]*(N:t) ) + _wanted plugins expl "-- Completion --" compadd "$@" -a - completions && ret=0 + ;; + creinstall) + # Complete only plugins that have any completions + # We must iterate each plugin to check + # for completions that can be installed + typeset -a plugins completions + local p c user plugin + for p in "${ZI[PLUGINS_DIR]}"/*; do + completions=( "$p"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|_zsh_highlight*|/zsdoc/*)(DN) ) + for c in "${completions[@]}"; do + p="${p:t}" + user="${p%%---*}" + plugin="${p#*---}" + [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" + plugins+=( "${user:+$user/}$plugin" ) + break + done + done + _wanted plugins expl "-- Plugin --" compadd "$@" -a - plugins && ret=0 + ;; + cuninstall) + # We must iterate each plugin and check if + # it has completions that are installed + typeset -a plugins completions + local p c user plugin cfile bkpfile + for p in "${ZI[PLUGINS_DIR]}"/*; do + completions=( "$p"/**/_[^_.][^.]#(N) ) + for c in "${completions[@]}"; do + cfile="${c:t}" + bkpfile="${cfile#_}" + # Completion installed, either enabled or disabled? + if [[ -e "${ZI[COMPLETIONS_DIR]}"/"$cfile" || -e "${ZI[COMPLETIONS_DIR]}"/"$bkpfile" ]]; then + p="${p:t}" + user="${p%%---*}" + plugin="${p#*---}" + [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" + plugins+=( "${user:+$user/}$plugin" ) + break + fi + done + done + _wanted plugins expl "-- Plugin --" compadd "$@" -a - plugins && ret=0 + ;; + compinit) + _message "Hit enter to refresh completion system" && ret=0 + ;; + snippet) + local -a snippets snippets_alreadyld + local sni + snippets=( "${ZI[SNIPPETS_DIR]}"/**/._zi(D/:h) ) + snippets=( ${snippets[@]#${ZI[SNIPPETS_DIR]}/} ) + snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} ) + snippets=( ${snippets[@]/--//} ) + for sni ( ${snippets[@]} ) { + if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then + snippets_alreadyld+=( $sni ) + snippets=( ${snippets[@]:#$sni} ) + fi + } + _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ + 'files:-- File --:_files' && ret=0 + ;; + dstart|dtrace) + _message "Hit enter to start tracking this session" && ret=0 + ;; + dstop) + _message "Hit enter to stop tracking this session" && ret=0 + ;; + dunload) + _message "Hit enter to revert changes recorded between dstart and dstop" && ret=0 + ;; + dreport) + _message "Hit enter to show report of what was going on in session" && ret=0 + ;; + dclear) + _message "Hit enter to clear report of what was going on in session" && ret=0 + ;; + compile-all) + _message 'Hit enter to compile all downloaded plugins' && ret=0 + ;; + uncompile) + typeset -a plugins + plugins=( "${ZI[PLUGINS_DIR]}"/*(N) ) + typeset -a show_plugins p matches + for p in "${plugins[@]}"; do + matches=( $p/*.zwc(N) ) + if [ "$#matches" -ne "0" ]; then + p="${p:t}" + [ "$p" = "_local---zi" ] && continue + [ "$p" = "custom" ] && continue + p="${p//---//}" + show_plugins+=( "$p" ) + fi + done + _wanted show_plugins expl "-- Plugin --" compadd "$@" -a - show_plugins && ret=0 + ;; + uncompile-all) + _message 'Hit enter remove compiled versions of all downloaded plugins' && ret=0 + ;; + compiled) + _message 'Hit enter to get list of compiled plugins' && ret=0 + ;; + cdlist) + _message 'Hit enter to show compdef replay list' && ret=0 + ;; + cdreplay) + _message 'Hit enter to replay recorded compdefs' && ret=0 + ;; + cdclear) + _message 'Hit enter to clear compdef replay list' && ret=0 + ;; + recently) + typeset -a timespecs + timespecs=( + "3 days":"code modified during last 3 days" + "1 week":"code modified during last 7 days (default)" + "1 month":"code modified during last month" + ) + _describe -t timespecs "Time spec" timespecs && ret=0 + ;; + create) + _message 'Plugin spec or just enter, to create new plugin' && ret=0 + ;; + env-whitelist) + _wanted plugins expl "-- Parameter To White List During Any Plugin Unload --" _parameters && ret=0 + ;; + *) + ret=1 + ;; + esac esac return $ret diff --git a/lib/zsh/autoload.zsh b/lib/zsh/autoload.zsh index 6fa241d2..4b7b66c2 100755 --- a/lib/zsh/autoload.zsh +++ b/lib/zsh/autoload.zsh @@ -603,8 +603,7 @@ ZI[EXTENDED_GLOB]="" } (( $? )) && cat return 0 -} -# ]]] +} # ]]] # FUNCTION: .zi-self-update [[[ # Updates ❮ ZI ❯ code (does a git pull). # @@ -615,9 +614,8 @@ ZI[EXTENDED_GLOB]="" [[ $1 = -q ]] && +zi-message "{info2}Updating »»» ❮ ZI ❯ {…}{rst}" local nl=$'\n' escape=$'\x1b[' local -a lines - ( builtin cd -q "$ZI[BIN_DIR]" && command git checkout main &>/dev/null && \ - command git checkout master &>/dev/null && command git fetch --quiet && \ - lines=( ${(f)"$(command git log --color --date=short --pretty=format:'%Cgreen%cd %h %Creset%s %Cred%d%Creset || %b' ..FETCH_HEAD)"} ) + ( builtin cd -q "$ZI[BIN_DIR]" && command git checkout main &>/dev/null && command git checkout master &>/dev/null && command git fetch --quiet && \ + lines=( ${(f)"$(command git log --color --date=short --pretty=format:'%Cgreen%cd %h %Creset%s %Cred%d%Creset || %b' ..FETCH_HEAD)"} ) if (( ${#lines} > 0 )); then # Remove the (origin/master ...) segments, to expect only tags to appear lines=( "${(S)lines[@]//\(([,[:blank:]]#(origin|HEAD|master|main)[^a-zA-Z]##(HEAD|origin|master|main)[,[:blank:]]#)#\)/}" ) @@ -705,394 +703,394 @@ ZI[EXTENDED_GLOB]="" # $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin) # $2 - plugin (only when $1 - i.e. user - given) .zi-unload() { - .zi-any-to-user-plugin "$1" "$2" - local uspl2="${reply[-2]}${${reply[-2]:#(%|/)*}:+/}${reply[-1]}" user="${reply[-2]}" plugin="${reply[-1]}" quiet="${${3:+1}:-0}" - local k - .zi-any-colorify-as-uspl2 "$uspl2" - (( quiet )) || builtin print -r -- "${ZI[col-bar]}---${ZI[col-rst]} Unloading plugin: $REPLY ${ZI[col-bar]}---${ZI[col-rst]}" - local ___dir - [[ "$user" = "%" ]] && ___dir="$plugin" || ___dir="${ZI[PLUGINS_DIR]}/${user:+${user}---}${plugin//\//---}" - # KSH_ARRAYS immunity - integer correct=0 - [[ -o "KSH_ARRAYS" ]] && correct=1 - # Allow unload for debug user - if [[ "$uspl2" != "_dtrace/_dtrace" ]]; then - .zi-exists-message "$1" "$2" || return 1 +.zi-any-to-user-plugin "$1" "$2" +local uspl2="${reply[-2]}${${reply[-2]:#(%|/)*}:+/}${reply[-1]}" user="${reply[-2]}" plugin="${reply[-1]}" quiet="${${3:+1}:-0}" +local k +.zi-any-colorify-as-uspl2 "$uspl2" +(( quiet )) || builtin print -r -- "${ZI[col-bar]}---${ZI[col-rst]} Unloading plugin: $REPLY ${ZI[col-bar]}---${ZI[col-rst]}" +local ___dir +[[ "$user" = "%" ]] && ___dir="$plugin" || ___dir="${ZI[PLUGINS_DIR]}/${user:+${user}---}${plugin//\//---}" +# KSH_ARRAYS immunity +integer correct=0 +[[ -o "KSH_ARRAYS" ]] && correct=1 +# Allow unload for debug user +if [[ "$uspl2" != "_dtrace/_dtrace" ]]; then + .zi-exists-message "$1" "$2" || return 1 +fi +.zi-any-colorify-as-uspl2 "$1" "$2" +local uspl2col="$REPLY" +# Store report of the plugin in variable LASTREPORT +typeset -g LASTREPORT +LASTREPORT=`.zi-show-report "$1" "$2"` + +# +# Call the Zsh Plugin's Standard *_plugin_unload function +# + +(( ${+functions[${plugin}_plugin_unload]} )) && ${plugin}_plugin_unload + +# +# Call the code provided by the Zsh Plugin's Standard @zsh-plugin-run-at-update +# + +local -a tmp +local -A sice +tmp=( "${(z@)ZI_SICE[$uspl2]}" ) +(( ${#tmp} > 1 && ${#tmp} % 2 == 0 )) && sice=( "${(Q)tmp[@]}" ) || sice=() +if [[ -n ${sice[ps-on-unload]} ]]; then + (( quiet )) || builtin print -r "Running plugin's provided unload code: ${ZI[col-info]}${sice[ps-on-unload][1,50]}${sice[ps-on-unload][51]:+…}${ZI[col-rst]}" + local ___oldcd="$PWD" + () { setopt localoptions noautopushd; builtin cd -q "$___dir"; } + eval "${sice[ps-on-unload]}" + () { setopt localoptions noautopushd; builtin cd -q "$___oldcd"; } +fi + +# +# 1. Delete done bindkeys +# + +typeset -a string_widget +string_widget=( "${(z)ZI[BINDKEYS__$uspl2]}" ) +local sw +for sw in "${(Oa)string_widget[@]}"; do + [[ -z "$sw" ]] && continue + # Remove one level of quoting to split using (z) + sw="${(Q)sw}" + typeset -a sw_arr + sw_arr=( "${(z)sw}" ) + # Remove one level of quoting to pass to bindkey + local sw_arr1="${(Q)sw_arr[1-correct]}" # Keys + local sw_arr2="${(Q)sw_arr[2-correct]}" # Widget + local sw_arr3="${(Q)sw_arr[3-correct]}" # Optional previous-bound widget + local sw_arr4="${(Q)sw_arr[4-correct]}" # Optional -M or -A or -N + local sw_arr5="${(Q)sw_arr[5-correct]}" # Optional map name + local sw_arr6="${(Q)sw_arr[6-correct]}" # Optional -R (not with -A, -N) + if [[ "$sw_arr4" = "-M" && "$sw_arr6" != "-R" ]]; then + if [[ -n "$sw_arr3" ]]; then + () { + emulate -LR zsh -o extendedglob + (( quiet )) || builtin print -r "Restoring bindkey ${${(q)sw_arr1}//(#m)\\[\^\?\]\[\)\(\'\"\}\{\`]/${MATCH#\\}} $sw_arr3 ${ZI[col-info]}in map ${ZI[col-rst]}$sw_arr5" + } + bindkey -M "$sw_arr5" "$sw_arr1" "$sw_arr3" + else + (( quiet )) || builtin print -r "Deleting bindkey ${(q)sw_arr1} $sw_arr2 ${ZI[col-info]}in map ${ZI[col-rst]}$sw_arr5" + bindkey -M "$sw_arr5" -r "$sw_arr1" + fi + elif [[ "$sw_arr4" = "-M" && "$sw_arr6" = "-R" ]]; then + if [[ -n "$sw_arr3" ]]; then + (( quiet )) || builtin print -r "Restoring ${ZI[col-info]}range${ZI[col-rst]} bindkey ${(q)sw_arr1} $sw_arr3 ${ZI[col-info]}in map ${ZI[col-rst]}$sw_arr5" + bindkey -RM "$sw_arr5" "$sw_arr1" "$sw_arr3" + else + (( quiet )) || builtin print -r "Deleting ${ZI[col-info]}range${ZI[col-rst]} bindkey ${(q)sw_arr1} $sw_arr2 ${ZI[col-info]}in map ${ZI[col-rst]}$sw_arr5" + bindkey -M "$sw_arr5" -Rr "$sw_arr1" + fi + elif [[ "$sw_arr4" != "-M" && "$sw_arr6" = "-R" ]]; then + if [[ -n "$sw_arr3" ]]; then + (( quiet )) || builtin print -r "Restoring ${ZI[col-info]}range${ZI[col-rst]} bindkey ${(q)sw_arr1} $sw_arr3" + bindkey -R "$sw_arr1" "$sw_arr3" + else + (( quiet )) || builtin print -r "Deleting ${ZI[col-info]}range${ZI[col-rst]} bindkey ${(q)sw_arr1} $sw_arr2" + bindkey -Rr "$sw_arr1" + fi + elif [[ "$sw_arr4" = "-A" ]]; then + (( quiet )) || builtin print -r "Linking backup-\`main' keymap \`$sw_arr5' back to \`main'" + bindkey -A "$sw_arr5" "main" + elif [[ "$sw_arr4" = "-N" ]]; then + (( quiet )) || builtin print -r "Deleting keymap \`$sw_arr5'" + bindkey -D "$sw_arr5" + else + if [[ -n "$sw_arr3" ]]; then + () { + emulate -LR zsh -o extendedglob + (( quiet )) || builtin print -r "Restoring bindkey ${${(q)sw_arr1}//(#m)\\[\^\?\]\[\)\(\'\"\}\{\`]/${MATCH#\\}} $sw_arr3" + } + bindkey "$sw_arr1" "$sw_arr3" + else + (( quiet )) || builtin print -r "Deleting bindkey ${(q)sw_arr1} $sw_arr2" + bindkey -r "$sw_arr1" + fi fi - .zi-any-colorify-as-uspl2 "$1" "$2" - local uspl2col="$REPLY" - # Store report of the plugin in variable LASTREPORT - typeset -g LASTREPORT - LASTREPORT=`.zi-show-report "$1" "$2"` - - # - # Call the Zsh Plugin's Standard *_plugin_unload function - # - - (( ${+functions[${plugin}_plugin_unload]} )) && ${plugin}_plugin_unload +done - # - # Call the code provided by the Zsh Plugin's Standard @zsh-plugin-run-at-update - # +# +# 2. Delete created Zstyles +# - local -a tmp - local -A sice - tmp=( "${(z@)ZI_SICE[$uspl2]}" ) - (( ${#tmp} > 1 && ${#tmp} % 2 == 0 )) && sice=( "${(Q)tmp[@]}" ) || sice=() - if [[ -n ${sice[ps-on-unload]} ]]; then - (( quiet )) || builtin print -r "Running plugin's provided unload code: ${ZI[col-info]}${sice[ps-on-unload][1,50]}${sice[ps-on-unload][51]:+…}${ZI[col-rst]}" - local ___oldcd="$PWD" - () { setopt localoptions noautopushd; builtin cd -q "$___dir"; } - eval "${sice[ps-on-unload]}" - () { setopt localoptions noautopushd; builtin cd -q "$___oldcd"; } - fi +typeset -a pattern_style +pattern_style=( "${(z)ZI[ZSTYLES__$uspl2]}" ) +local ps +for ps in "${(Oa)pattern_style[@]}"; do + [[ -z "$ps" ]] && continue + # Remove one level of quoting to split using (z) + ps="${(Q)ps}" + typeset -a ps_arr + ps_arr=( "${(z)ps}" ) + # Remove one level of quoting to pass to zstyle + local ps_arr1="${(Q)ps_arr[1-correct]}" + local ps_arr2="${(Q)ps_arr[2-correct]}" + (( quiet )) || builtin print "Deleting zstyle $ps_arr1 $ps_arr2" + zstyle -d "$ps_arr1" "$ps_arr2" +done - # - # 1. Delete done bindkeys - # +# +# 3. Restore changed options +# - typeset -a string_widget - string_widget=( "${(z)ZI[BINDKEYS__$uspl2]}" ) - local sw - for sw in "${(Oa)string_widget[@]}"; do - [[ -z "$sw" ]] && continue - # Remove one level of quoting to split using (z) - sw="${(Q)sw}" - typeset -a sw_arr - sw_arr=( "${(z)sw}" ) - # Remove one level of quoting to pass to bindkey - local sw_arr1="${(Q)sw_arr[1-correct]}" # Keys - local sw_arr2="${(Q)sw_arr[2-correct]}" # Widget - local sw_arr3="${(Q)sw_arr[3-correct]}" # Optional previous-bound widget - local sw_arr4="${(Q)sw_arr[4-correct]}" # Optional -M or -A or -N - local sw_arr5="${(Q)sw_arr[5-correct]}" # Optional map name - local sw_arr6="${(Q)sw_arr[6-correct]}" # Optional -R (not with -A, -N) - if [[ "$sw_arr4" = "-M" && "$sw_arr6" != "-R" ]]; then - if [[ -n "$sw_arr3" ]]; then - () { - emulate -LR zsh -o extendedglob - (( quiet )) || builtin print -r "Restoring bindkey ${${(q)sw_arr1}//(#m)\\[\^\?\]\[\)\(\'\"\}\{\`]/${MATCH#\\}} $sw_arr3 ${ZI[col-info]}in map ${ZI[col-rst]}$sw_arr5" - } - bindkey -M "$sw_arr5" "$sw_arr1" "$sw_arr3" - else - (( quiet )) || builtin print -r "Deleting bindkey ${(q)sw_arr1} $sw_arr2 ${ZI[col-info]}in map ${ZI[col-rst]}$sw_arr5" - bindkey -M "$sw_arr5" -r "$sw_arr1" - fi - elif [[ "$sw_arr4" = "-M" && "$sw_arr6" = "-R" ]]; then - if [[ -n "$sw_arr3" ]]; then - (( quiet )) || builtin print -r "Restoring ${ZI[col-info]}range${ZI[col-rst]} bindkey ${(q)sw_arr1} $sw_arr3 ${ZI[col-info]}in map ${ZI[col-rst]}$sw_arr5" - bindkey -RM "$sw_arr5" "$sw_arr1" "$sw_arr3" - else - (( quiet )) || builtin print -r "Deleting ${ZI[col-info]}range${ZI[col-rst]} bindkey ${(q)sw_arr1} $sw_arr2 ${ZI[col-info]}in map ${ZI[col-rst]}$sw_arr5" - bindkey -M "$sw_arr5" -Rr "$sw_arr1" - fi - elif [[ "$sw_arr4" != "-M" && "$sw_arr6" = "-R" ]]; then - if [[ -n "$sw_arr3" ]]; then - (( quiet )) || builtin print -r "Restoring ${ZI[col-info]}range${ZI[col-rst]} bindkey ${(q)sw_arr1} $sw_arr3" - bindkey -R "$sw_arr1" "$sw_arr3" - else - (( quiet )) || builtin print -r "Deleting ${ZI[col-info]}range${ZI[col-rst]} bindkey ${(q)sw_arr1} $sw_arr2" - bindkey -Rr "$sw_arr1" - fi - elif [[ "$sw_arr4" = "-A" ]]; then - (( quiet )) || builtin print -r "Linking backup-\`main' keymap \`$sw_arr5' back to \`main'" - bindkey -A "$sw_arr5" "main" - elif [[ "$sw_arr4" = "-N" ]]; then - (( quiet )) || builtin print -r "Deleting keymap \`$sw_arr5'" - bindkey -D "$sw_arr5" +# Paranoid, don't want bad key/value pair error +.zi-diff-options-compute "$uspl2" +integer empty=0 +.zi-save-set-extendedglob +[[ "${ZI[OPTIONS__$uspl2]}" != *[$'! \t']* ]] && empty=1 +.zi-restore-extendedglob +if (( empty != 1 )); then + typeset -A opts + opts=( "${(z)ZI[OPTIONS__$uspl2]}" ) + for k in "${(kon)opts[@]}"; do + # Internal options + [[ "$k" = "physical" ]] && continue + if [[ "${opts[$k]}" = "on" ]]; then + (( quiet )) || builtin print "Setting option $k" + builtin setopt "$k" else - if [[ -n "$sw_arr3" ]]; then - () { - emulate -LR zsh -o extendedglob - (( quiet )) || builtin print -r "Restoring bindkey ${${(q)sw_arr1}//(#m)\\[\^\?\]\[\)\(\'\"\}\{\`]/${MATCH#\\}} $sw_arr3" - } - bindkey "$sw_arr1" "$sw_arr3" - else - (( quiet )) || builtin print -r "Deleting bindkey ${(q)sw_arr1} $sw_arr2" - bindkey -r "$sw_arr1" - fi + (( quiet )) || builtin print "Unsetting option $k" + builtin unsetopt "$k" fi done - - # - # 2. Delete created Zstyles - # - - typeset -a pattern_style - pattern_style=( "${(z)ZI[ZSTYLES__$uspl2]}" ) - local ps - for ps in "${(Oa)pattern_style[@]}"; do - [[ -z "$ps" ]] && continue - # Remove one level of quoting to split using (z) - ps="${(Q)ps}" - typeset -a ps_arr - ps_arr=( "${(z)ps}" ) - # Remove one level of quoting to pass to zstyle - local ps_arr1="${(Q)ps_arr[1-correct]}" - local ps_arr2="${(Q)ps_arr[2-correct]}" - (( quiet )) || builtin print "Deleting zstyle $ps_arr1 $ps_arr2" - zstyle -d "$ps_arr1" "$ps_arr2" - done - - # - # 3. Restore changed options - # - - # Paranoid, don't want bad key/value pair error - .zi-diff-options-compute "$uspl2" - integer empty=0 - .zi-save-set-extendedglob - [[ "${ZI[OPTIONS__$uspl2]}" != *[$'! \t']* ]] && empty=1 - .zi-restore-extendedglob - if (( empty != 1 )); then - typeset -A opts - opts=( "${(z)ZI[OPTIONS__$uspl2]}" ) - for k in "${(kon)opts[@]}"; do - # Internal options - [[ "$k" = "physical" ]] && continue - if [[ "${opts[$k]}" = "on" ]]; then - (( quiet )) || builtin print "Setting option $k" - builtin setopt "$k" - else - (( quiet )) || builtin print "Unsetting option $k" - builtin unsetopt "$k" - fi - done - fi - - # - # 4. Delete aliases - # - - typeset -a aname_avalue - aname_avalue=( "${(z)ZI[ALIASES__$uspl2]}" ) - local nv - for nv in "${(Oa)aname_avalue[@]}"; do - [[ -z "$nv" ]] && continue - # Remove one level of quoting to split using (z) - nv="${(Q)nv}" - typeset -a nv_arr - nv_arr=( "${(z)nv}" ) - # Remove one level of quoting to pass to unalias - local nv_arr1="${(Q)nv_arr[1-correct]}" - local nv_arr2="${(Q)nv_arr[2-correct]}" - local nv_arr3="${(Q)nv_arr[3-correct]}" - if [[ "$nv_arr3" = "-s" ]]; then - if [[ -n "$nv_arr2" ]]; then - (( quiet )) || builtin print "Restoring ${ZI[col-info]}suffix${ZI[col-rst]} alias ${nv_arr1}=${nv_arr2}" - alias "$nv_arr1" &> /dev/null && unalias -s -- "$nv_arr1" - alias -s -- "${nv_arr1}=${nv_arr2}" - else - (( quiet )) || alias "$nv_arr1" &> /dev/null && { - builtin print "Removing ${ZI[col-info]}suffix${ZI[col-rst]} alias ${nv_arr1}" - unalias -s -- "$nv_arr1" - } - fi - elif [[ "$nv_arr3" = "-g" ]]; then - if [[ -n "$nv_arr2" ]]; then - (( quiet )) || builtin print "Restoring ${ZI[col-info]}global${ZI[col-rst]} alias ${nv_arr1}=${nv_arr2}" - alias "$nv_arr1" &> /dev/null && unalias -g -- "$nv_arr1" - alias -g -- "${nv_arr1}=${nv_arr2}" - else - (( quiet )) || alias "$nv_arr1" &> /dev/null && { - builtin print "Removing ${ZI[col-info]}global${ZI[col-rst]} alias ${nv_arr1}" - unalias -- "${(q)nv_arr1}" - } - fi +fi + +# +# 4. Delete aliases +# + +typeset -a aname_avalue +aname_avalue=( "${(z)ZI[ALIASES__$uspl2]}" ) +local nv +for nv in "${(Oa)aname_avalue[@]}"; do + [[ -z "$nv" ]] && continue + # Remove one level of quoting to split using (z) + nv="${(Q)nv}" + typeset -a nv_arr + nv_arr=( "${(z)nv}" ) + # Remove one level of quoting to pass to unalias + local nv_arr1="${(Q)nv_arr[1-correct]}" + local nv_arr2="${(Q)nv_arr[2-correct]}" + local nv_arr3="${(Q)nv_arr[3-correct]}" + if [[ "$nv_arr3" = "-s" ]]; then + if [[ -n "$nv_arr2" ]]; then + (( quiet )) || builtin print "Restoring ${ZI[col-info]}suffix${ZI[col-rst]} alias ${nv_arr1}=${nv_arr2}" + alias "$nv_arr1" &> /dev/null && unalias -s -- "$nv_arr1" + alias -s -- "${nv_arr1}=${nv_arr2}" else - if [[ -n "$nv_arr2" ]]; then - (( quiet )) || builtin print "Restoring alias ${nv_arr1}=${nv_arr2}" - alias "$nv_arr1" &> /dev/null && unalias -- "$nv_arr1" - alias -- "${nv_arr1}=${nv_arr2}" - else - (( quiet )) || alias "$nv_arr1" &> /dev/null && { - builtin print "Removing alias ${nv_arr1}" - unalias -- "$nv_arr1" - } - fi + (( quiet )) || alias "$nv_arr1" &> /dev/null && { + builtin print "Removing ${ZI[col-info]}suffix${ZI[col-rst]} alias ${nv_arr1}" + unalias -s -- "$nv_arr1" + } fi - done + elif [[ "$nv_arr3" = "-g" ]]; then + if [[ -n "$nv_arr2" ]]; then + (( quiet )) || builtin print "Restoring ${ZI[col-info]}global${ZI[col-rst]} alias ${nv_arr1}=${nv_arr2}" + alias "$nv_arr1" &> /dev/null && unalias -g -- "$nv_arr1" + alias -g -- "${nv_arr1}=${nv_arr2}" + else + (( quiet )) || alias "$nv_arr1" &> /dev/null && { + builtin print "Removing ${ZI[col-info]}global${ZI[col-rst]} alias ${nv_arr1}" + unalias -- "${(q)nv_arr1}" + } + fi + else + if [[ -n "$nv_arr2" ]]; then + (( quiet )) || builtin print "Restoring alias ${nv_arr1}=${nv_arr2}" + alias "$nv_arr1" &> /dev/null && unalias -- "$nv_arr1" + alias -- "${nv_arr1}=${nv_arr2}" + else + (( quiet )) || alias "$nv_arr1" &> /dev/null && { + builtin print "Removing alias ${nv_arr1}" + unalias -- "$nv_arr1" + } + fi + fi +done - # - # 5. Restore Zle state - # +# +# 5. Restore Zle state +# - local -a keys - keys=( "${(@on)ZI[(I)TIME_<->_*]}" ) - integer keys_size=${#keys} - () { - setopt localoptions extendedglob noksharrays typesetsilent - typeset -a restore_widgets skip_delete - local wid - restore_widgets=( "${(z)ZI[WIDGETS_SAVED__$uspl2]}" ) - for wid in "${(Oa)restore_widgets[@]}"; do - [[ -z "$wid" ]] && continue - wid="${(Q)wid}" - typeset -a orig_saved - orig_saved=( "${(z)wid}" ) - local tpe="${orig_saved[1]}" - local orig_saved1="${(Q)orig_saved[2]}" # Original widget - local comp_wid="${(Q)orig_saved[3]}" - local orig_saved2="${(Q)orig_saved[4]}" # Saved target function - local orig_saved3="${(Q)orig_saved[5]}" # Saved previous $widget's contents - local found_time_key="${keys[(r)TIME_<->_${uspl2//\//---}]}" to_process_plugin - integer found_time_idx=0 idx=0 - to_process_plugin="" - [[ "$found_time_key" = (#b)TIME_(<->)_* ]] && found_time_idx="${match[1]}" - if (( found_time_idx )); then # Must be true - for (( idx = found_time_idx + 1; idx <= keys_size; ++ idx )); do - found_time_key="${keys[(r)TIME_${idx}_*]}" - local oth_uspl2="" - [[ "$found_time_key" = (#b)TIME_${idx}_(*) ]] && oth_uspl2="${match[1]//---//}" - local -a entry_splitted - entry_splitted=( "${(z@)ZI[WIDGETS_SAVED__$oth_uspl2]}" ) - integer found_idx="${entry_splitted[(I)(-N|-C)\ $orig_saved1\\\ *]}" - local -a entry_splitted2 - entry_splitted2=( "${(z@)ZI[BINDKEYS__$oth_uspl2]}" ) - integer found_idx2="${entry_splitted2[(I)*\ $orig_saved1\ *]}" - if (( found_idx || found_idx2 )) - then - # Skip multiple loads of the same plugin - # TODO: Fully handle multiple plugin loads - if [[ "$oth_uspl2" != "$uspl2" ]]; then - to_process_plugin="$oth_uspl2" - break # Only the first one is needed - fi - fi - done - if [[ -n "$to_process_plugin" ]]; then - if (( !found_idx && !found_idx2 )); then - (( quiet )) || builtin print "Problem (1) during handling of widget \`$orig_saved1' (contents: $orig_saved2)" - continue +local -a keys +keys=( "${(@on)ZI[(I)TIME_<->_*]}" ) +integer keys_size=${#keys} +() { + setopt localoptions extendedglob noksharrays typesetsilent + typeset -a restore_widgets skip_delete + local wid + restore_widgets=( "${(z)ZI[WIDGETS_SAVED__$uspl2]}" ) + for wid in "${(Oa)restore_widgets[@]}"; do + [[ -z "$wid" ]] && continue + wid="${(Q)wid}" + typeset -a orig_saved + orig_saved=( "${(z)wid}" ) + local tpe="${orig_saved[1]}" + local orig_saved1="${(Q)orig_saved[2]}" # Original widget + local comp_wid="${(Q)orig_saved[3]}" + local orig_saved2="${(Q)orig_saved[4]}" # Saved target function + local orig_saved3="${(Q)orig_saved[5]}" # Saved previous $widget's contents + local found_time_key="${keys[(r)TIME_<->_${uspl2//\//---}]}" to_process_plugin + integer found_time_idx=0 idx=0 + to_process_plugin="" + [[ "$found_time_key" = (#b)TIME_(<->)_* ]] && found_time_idx="${match[1]}" + if (( found_time_idx )); then # Must be true + for (( idx = found_time_idx + 1; idx <= keys_size; ++ idx )); do + found_time_key="${keys[(r)TIME_${idx}_*]}" + local oth_uspl2="" + [[ "$found_time_key" = (#b)TIME_${idx}_(*) ]] && oth_uspl2="${match[1]//---//}" + local -a entry_splitted + entry_splitted=( "${(z@)ZI[WIDGETS_SAVED__$oth_uspl2]}" ) + integer found_idx="${entry_splitted[(I)(-N|-C)\ $orig_saved1\\\ *]}" + local -a entry_splitted2 + entry_splitted2=( "${(z@)ZI[BINDKEYS__$oth_uspl2]}" ) + integer found_idx2="${entry_splitted2[(I)*\ $orig_saved1\ *]}" + if (( found_idx || found_idx2 )) + then + # Skip multiple loads of the same plugin + # TODO: #56 Fully handle multiple plugin loads + if [[ "$oth_uspl2" != "$uspl2" ]]; then + to_process_plugin="$oth_uspl2" + break # Only the first one is needed fi - (( quiet )) || builtin print "Chaining widget \`$orig_saved1' to plugin $oth_uspl2" - local -a oth_orig_saved - if (( found_idx )) { - oth_orig_saved=( "${(z)${(Q)entry_splitted[found_idx]}}" ) - local oth_fun="${oth_orig_saved[4]}" - # oth_orig_saved[2]="${(q)orig_saved2}" # not do this, because - # we don't want to call other plugin's function at any moment - oth_orig_saved[5]="${(q)orig_saved3}" # chain up the widget - entry_splitted[found_idx]="${(q)${(j: :)oth_orig_saved}}" - ZI[WIDGETS_SAVED__$oth_uspl2]="${(j: :)entry_splitted}" - } else { - oth_orig_saved=( "${(z)${(Q)entry_splitted2[found_idx2]}}" ) - local oth_fun="${widgets[${oth_orig_saved[3]}]#*:}" - } - integer idx="${functions[$orig_saved2][(i)(#b)([^[:space:]]#${orig_saved1}[^[:space:]]#)]}" - if (( idx <= ${#functions[$orig_saved2]} )) - then - local prefix_X="${match[1]#\{}" - [[ $prefix_X != \$* ]] && prefix_X="${prefix_X%\}}" - idx="${functions[$oth_fun][(i)(#b)([^[:space:]]#${orig_saved1}[^[:space:]]#)]}" - if (( idx <= ${#functions[$oth_fun]} )); then - match[1]="${match[1]#\{}" - [[ ${match[1]} != \$* ]] && match[1]="${match[1]%\}}" - eval "local oth_prefix_uspl2_X=\"${match[1]}\"" - if [[ "${widgets[$prefix_X]}" = builtin ]]; then - (( quiet )) || builtin print "Builtin-restoring widget \`$oth_prefix_uspl2_X' ($oth_uspl2)" - zle -A ".${prefix_X#.}" "$oth_prefix_uspl2_X" - elif [[ "${widgets[$prefix_X]}" = completion:* ]]; then - (( quiet )) || builtin print "Chain*-restoring widget \`$oth_prefix_uspl2_X' ($oth_uspl2)" - zle -C "$oth_prefix_uspl2_X" "${(@)${(@s.:.)${orig_saved3#user:}}[2,3]}" - else - (( quiet )) || builtin print "Chain-restoring widget \`$oth_prefix_uspl2_X' ($oth_uspl2)" - zle -N "$oth_prefix_uspl2_X" "${widgets[$prefix_X]#user:}" - fi + fi + done + if [[ -n "$to_process_plugin" ]]; then + if (( !found_idx && !found_idx2 )); then + (( quiet )) || builtin print "Problem (1) during handling of widget \`$orig_saved1' (contents: $orig_saved2)" + continue + fi + (( quiet )) || builtin print "Chaining widget \`$orig_saved1' to plugin $oth_uspl2" + local -a oth_orig_saved + if (( found_idx )) { + oth_orig_saved=( "${(z)${(Q)entry_splitted[found_idx]}}" ) + local oth_fun="${oth_orig_saved[4]}" + # oth_orig_saved[2]="${(q)orig_saved2}" # not do this, because + # we don't want to call other plugin's function at any moment + oth_orig_saved[5]="${(q)orig_saved3}" # chain up the widget + entry_splitted[found_idx]="${(q)${(j: :)oth_orig_saved}}" + ZI[WIDGETS_SAVED__$oth_uspl2]="${(j: :)entry_splitted}" + } else { + oth_orig_saved=( "${(z)${(Q)entry_splitted2[found_idx2]}}" ) + local oth_fun="${widgets[${oth_orig_saved[3]}]#*:}" + } + integer idx="${functions[$orig_saved2][(i)(#b)([^[:space:]]#${orig_saved1}[^[:space:]]#)]}" + if (( idx <= ${#functions[$orig_saved2]} )) + then + local prefix_X="${match[1]#\{}" + [[ $prefix_X != \$* ]] && prefix_X="${prefix_X%\}}" + idx="${functions[$oth_fun][(i)(#b)([^[:space:]]#${orig_saved1}[^[:space:]]#)]}" + if (( idx <= ${#functions[$oth_fun]} )); then + match[1]="${match[1]#\{}" + [[ ${match[1]} != \$* ]] && match[1]="${match[1]%\}}" + eval "local oth_prefix_uspl2_X=\"${match[1]}\"" + if [[ "${widgets[$prefix_X]}" = builtin ]]; then + (( quiet )) || builtin print "Builtin-restoring widget \`$oth_prefix_uspl2_X' ($oth_uspl2)" + zle -A ".${prefix_X#.}" "$oth_prefix_uspl2_X" + elif [[ "${widgets[$prefix_X]}" = completion:* ]]; then + (( quiet )) || builtin print "Chain*-restoring widget \`$oth_prefix_uspl2_X' ($oth_uspl2)" + zle -C "$oth_prefix_uspl2_X" "${(@)${(@s.:.)${orig_saved3#user:}}[2,3]}" + else + (( quiet )) || builtin print "Chain-restoring widget \`$oth_prefix_uspl2_X' ($oth_uspl2)" + zle -N "$oth_prefix_uspl2_X" "${widgets[$prefix_X]#user:}" fi - # The alternate method - # skip_delete+=( "${match[1]}" ) - # functions[$oth_fun]="${functions[$oth_fun]//[^\{[:space:]]#$orig_saved1/${match[1]}}" - fi - else - (( quiet )) || builtin print "Restoring Zle widget $orig_saved1" - if [[ "$orig_saved3" = builtin ]]; then - zle -A ".$orig_saved1" "$orig_saved1" - elif [[ "$orig_saved3" = completion:* ]]; then - zle -C "$orig_saved1" "${(@)${(@s.:.)${orig_saved3#user:}}[2,3]}" - else - zle -N "$orig_saved1" "${orig_saved3#user:}" fi + # The alternate method + # skip_delete+=( "${match[1]}" ) + # functions[$oth_fun]="${functions[$oth_fun]//[^\{[:space:]]#$orig_saved1/${match[1]}}" fi else - (( quiet )) || builtin print "Problem (2) during handling of widget \`$orig_saved1' (contents: $orig_saved2)" + (( quiet )) || builtin print "Restoring Zle widget $orig_saved1" + if [[ "$orig_saved3" = builtin ]]; then + zle -A ".$orig_saved1" "$orig_saved1" + elif [[ "$orig_saved3" = completion:* ]]; then + zle -C "$orig_saved1" "${(@)${(@s.:.)${orig_saved3#user:}}[2,3]}" + else + zle -N "$orig_saved1" "${orig_saved3#user:}" + fi fi - done - } - typeset -a delete_widgets - delete_widgets=( "${(z)ZI[WIDGETS_DELETE__$uspl2]}" ) - local wid - for wid in "${(Oa)delete_widgets[@]}"; do - [[ -z "$wid" ]] && continue - wid="${(Q)wid}" - if [[ -n "${skip_delete[(r)$wid]}" ]]; then - builtin print "Would delete $wid" - continue - fi - if [[ "${ZI_ZLE_HOOKS_LIST[$wid]}" = "1" ]]; then - (( quiet )) || builtin print "Removing Zle hook \`$wid'" else - (( quiet )) || builtin print "Removing Zle widget \`$wid'" + (( quiet )) || builtin print "Problem (2) during handling of widget \`$orig_saved1' (contents: $orig_saved2)" fi - zle -D "$wid" done +} +typeset -a delete_widgets +delete_widgets=( "${(z)ZI[WIDGETS_DELETE__$uspl2]}" ) +local wid +for wid in "${(Oa)delete_widgets[@]}"; do + [[ -z "$wid" ]] && continue + wid="${(Q)wid}" + if [[ -n "${skip_delete[(r)$wid]}" ]]; then + builtin print "Would delete $wid" + continue + fi + if [[ "${ZI_ZLE_HOOKS_LIST[$wid]}" = "1" ]]; then + (( quiet )) || builtin print "Removing Zle hook \`$wid'" + else + (( quiet )) || builtin print "Removing Zle widget \`$wid'" + fi + zle -D "$wid" +done - # - # 6. Unfunction - # +# +# 6. Unfunction +# - .zi-diff-functions-compute "$uspl2" - typeset -a func - func=( "${(z)ZI[FUNCTIONS__$uspl2]}" ) - local f - for f in "${(on)func[@]}"; do - [[ -z "$f" ]] && continue - f="${(Q)f}" - (( quiet )) || builtin print "Deleting function $f" - (( ${+functions[$f]} )) && unfunction -- "$f" - (( ${+precmd_functions} )) && precmd_functions=( ${precmd_functions[@]:#$f} ) - (( ${+preexec_functions} )) && preexec_functions=( ${preexec_functions[@]:#$f} ) - (( ${+chpwd_functions} )) && chpwd_functions=( ${chpwd_functions[@]:#$f} ) - (( ${+periodic_functions} )) && periodic_functions=( ${periodic_functions[@]:#$f} ) - (( ${+zshaddhistory_functions} )) && zshaddhistory_functions=( ${zshaddhistory_functions[@]:#$f} ) - (( ${+zshexit_functions} )) && zshexit_functions=( ${zshexit_functions[@]:#$f} ) - done +.zi-diff-functions-compute "$uspl2" +typeset -a func +func=( "${(z)ZI[FUNCTIONS__$uspl2]}" ) +local f +for f in "${(on)func[@]}"; do + [[ -z "$f" ]] && continue + f="${(Q)f}" + (( quiet )) || builtin print "Deleting function $f" + (( ${+functions[$f]} )) && unfunction -- "$f" + (( ${+precmd_functions} )) && precmd_functions=( ${precmd_functions[@]:#$f} ) + (( ${+preexec_functions} )) && preexec_functions=( ${preexec_functions[@]:#$f} ) + (( ${+chpwd_functions} )) && chpwd_functions=( ${chpwd_functions[@]:#$f} ) + (( ${+periodic_functions} )) && periodic_functions=( ${periodic_functions[@]:#$f} ) + (( ${+zshaddhistory_functions} )) && zshaddhistory_functions=( ${zshaddhistory_functions[@]:#$f} ) + (( ${+zshexit_functions} )) && zshexit_functions=( ${zshexit_functions[@]:#$f} ) +done - # - # 7. Clean up FPATH and PATH - # +# +# 7. Clean up FPATH and PATH +# - .zi-diff-env-compute "$uspl2" +.zi-diff-env-compute "$uspl2" - # Have to iterate over $path elements and - # skip those that were added by the plugin - typeset -a new elem p - elem=( "${(z)ZI[PATH__$uspl2]}" ) - for p in "${path[@]}"; do - if [[ -z "${elem[(r)${(q)p}]}" ]] { - new+=( "$p" ) - } else { - (( quiet )) || builtin print "Removing PATH element ${ZI[col-info]}$p${ZI[col-rst]}" - [[ -d "$p" ]] || (( quiet )) || builtin print "${ZI[col-error]}Warning:${ZI[col-rst]} it didn't exist on disk" - } - done - path=( "${new[@]}" ) - # The same for $fpath - elem=( "${(z)ZI[FPATH__$uspl2]}" ) - new=( ) - for p ( "${fpath[@]}" ) { - if [[ -z "${elem[(r)${(q)p}]}" ]] { - new+=( "$p" ) - } else { - (( quiet )) || builtin print "Removing FPATH element ${ZI[col-info]}$p${ZI[col-rst]}" - [[ -d "$p" ]] || (( quiet )) || builtin print "${ZI[col-error]}Warning:${ZI[col-rst]} it didn't exist on disk" - } +# Have to iterate over $path elements and +# skip those that were added by the plugin +typeset -a new elem p +elem=( "${(z)ZI[PATH__$uspl2]}" ) +for p in "${path[@]}"; do + if [[ -z "${elem[(r)${(q)p}]}" ]] { + new+=( "$p" ) + } else { + (( quiet )) || builtin print "Removing PATH element ${ZI[col-info]}$p${ZI[col-rst]}" + [[ -d "$p" ]] || (( quiet )) || builtin print "${ZI[col-error]}Warning:${ZI[col-rst]} it didn't exist on disk" } - fpath=( "${new[@]}" ) +done +path=( "${new[@]}" ) +# The same for $fpath +elem=( "${(z)ZI[FPATH__$uspl2]}" ) +new=( ) +for p ( "${fpath[@]}" ) { + if [[ -z "${elem[(r)${(q)p}]}" ]] { + new+=( "$p" ) + } else { + (( quiet )) || builtin print "Removing FPATH element ${ZI[col-info]}$p${ZI[col-rst]}" + [[ -d "$p" ]] || (( quiet )) || builtin print "${ZI[col-error]}Warning:${ZI[col-rst]} it didn't exist on disk" + } +} +fpath=( "${new[@]}" ) - # - # 8. Delete created variables - # +# +# 8. Delete created variables +# .zi-diff-parameter-compute "$uspl2" empty=0 @@ -1117,7 +1115,7 @@ ZI[EXTENDED_GLOB]="" [[ ${(tP)k} == *-readonly(|-*) ]] && continue # Don't unset arrays managed by add-zsh-hook, # also ignore a few special parameters - # TODO: remember and remove hooks + # TODO: #55 remember and remove hooks case "$k" in (chpwd_functions|precmd_functions|preexec_functions|periodic_functions|zshaddhistory_functions|zshexit_functions|zsh_directory_name_functions) continue @@ -1151,20 +1149,20 @@ ZI[EXTENDED_GLOB]="" done fi - # - # 9. Forget the plugin - # +# +# 9. Forget the plugin +# - if [[ "$uspl2" = "_dtrace/_dtrace" ]]; then - .zi-clear-debug-report - (( quiet )) || builtin print "dtrace report saved to \$LASTREPORT" - else - (( quiet )) || builtin print "Unregistering plugin $uspl2col" - .zi-unregister-plugin "$user" "$plugin" "${sice[teleid]}" - zsh_loaded_plugins[${zsh_loaded_plugins[(i)$user${${user:#(%|/)*}:+/}$plugin]}]=() # Support Zsh plugin standard - .zi-clear-report-for "$user" "$plugin" - (( quiet )) || builtin print "Plugin's report saved to \$LASTREPORT" - fi +if [[ "$uspl2" = "_dtrace/_dtrace" ]]; then + .zi-clear-debug-report + (( quiet )) || builtin print "dtrace report saved to \$LASTREPORT" +else + (( quiet )) || builtin print "Unregistering plugin $uspl2col" + .zi-unregister-plugin "$user" "$plugin" "${sice[teleid]}" + zsh_loaded_plugins[${zsh_loaded_plugins[(i)$user${${user:#(%|/)*}:+/}$plugin]}]=() # Support Zsh plugin standard + .zi-clear-report-for "$user" "$plugin" + (( quiet )) || builtin print "Plugin's report saved to \$LASTREPORT" +fi } # ]]] # FUNCTION: .zi-show-report [[[ @@ -1295,16 +1293,12 @@ ZI[EXTENDED_GLOB]="" was_snippet=1 fi .zi-any-to-user-plugin "$2" "$3" - local user=${reply[-2]} plugin=${reply[-1]} st=$1 \ - local_dir filename is_snippet key \ - id_as="${reply[-2]}${${reply[-2]:#(%|/)*}:+/}${reply[-1]}" + local user=${reply[-2]} plugin=${reply[-1]} st=$1 local_dir filename is_snippet key id_as="${reply[-2]}${${reply[-2]:#(%|/)*}:+/}${reply[-1]}" local -A ice if (( was_snippet )) { .zi-exists-physically "$user" "$plugin" || return $retval .zi-any-colorify-as-uspl2 "$2" "$3" - (( !OPTS[opt_-q,--quiet] )) && \ - +zi-message "{msg2}Updating also \`$REPLY{rst}{msg2}'" \ - "plugin (already updated a snippet of the same name){…}{rst}" + (( !OPTS[opt_-q,--quiet] )) && +zi-message "{msg2}Updating also \`$REPLY{rst}{msg2}'" "plugin (already updated a snippet of the same name){…}{rst}" } else { .zi-exists-physically-message "$user" "$plugin" || return 1 } @@ -1313,14 +1307,13 @@ ZI[EXTENDED_GLOB]="" return $retval fi command rm -f ${TMPDIR:-${TMPDIR:-/tmp}}/zi-execs.$$.lst ${TMPDIR:-${TMPDIR:-/tmp}}/zi.installed_comps.$$.lst \ - ${TMPDIR:-${TMPDIR:-/tmp}}/zi.skipped_comps.$$.lst ${TMPDIR:-${TMPDIR:-/tmp}}/zi.compiled.$$.lst + ${TMPDIR:-${TMPDIR:-/tmp}}/zi.skipped_comps.$$.lst ${TMPDIR:-${TMPDIR:-/tmp}}/zi.compiled.$$.lst # A flag for the annexes. 0 – no new commits, 1 - run-atpull mode, # 2 – full update/there are new commits to download, 3 - full but # a forced download (i.e.: the medium doesn't allow to peek update) ZI[annex-multi-flag:pull-active]=0 (( ${#ICE[@]} > 0 )) && { ZI_SICE[$user${${user:#(%|/)*}:+/}$plugin]=""; local nf="-nftid"; } - .zi-compute-ice "$user${${user:#(%|/)*}:+/}$plugin" "pack$nf" \ - ice local_dir filename is_snippet || return 1 + .zi-compute-ice "$user${${user:#(%|/)*}:+/}$plugin" "pack$nf" ice local_dir filename is_snippet || return 1 .zi-any-to-user-plugin ${ice[teleid]:-$id_as} user=${reply[1]} plugin=${reply[2]} local repo="${${${(M)id_as#%}:+${id_as#%}}:-${ZI[PLUGINS_DIR]}/${id_as//\//---}}" @@ -1377,9 +1370,7 @@ ZI[EXTENDED_GLOB]="" count+=1 local version=${REPLY/(#b)(\/[^\/]##)(#c4,4)\/([^\/]##)*/${match[2]}} if [[ ${ice[is_release${count:#1}]} = $REPLY ]] { - (( ${+ice[run-atpull]} || OPTS[opt_-u,--urge] )) && \ - ZI[annex-multi-flag:pull-active]=1 || \ - ZI[annex-multi-flag:pull-active]=0 + (( ${+ice[run-atpull]} || OPTS[opt_-u,--urge] )) && ZI[annex-multi-flag:pull-active]=1 || ZI[annex-multi-flag:pull-active]=0 } else { ZI[annex-multi-flag:pull-active]=2 break @@ -1579,8 +1570,7 @@ ZI[EXTENDED_GLOB]="" local st="$1" URL="${2%/}" local_dir filename is_snippet (( ${#ICE[@]} > 0 )) && { ZI_SICE[$URL]=""; local nf="-nftid"; } local -A ICE2 - .zi-compute-ice "$URL" "pack$nf" \ - ICE2 local_dir filename is_snippet || return 1 + .zi-compute-ice "$URL" "pack$nf" ICE2 local_dir filename is_snippet || return 1 integer retval if [[ "$st" = "status" ]]; then if (( ${+ICE2[svn]} )); then @@ -1605,8 +1595,7 @@ ZI[EXTENDED_GLOB]="" builtin print ${ZI[annex-multi-flag:pull-active]} >! $PUFILE.ind } return $retval -} -# ]]] +} # ]]] # FUNCTION: .zi-update-or-status-all [[[ # Updates (git pull) or does `git status` for all existing plugins. # This includes also plugins that are not loaded into Zsh (but exist @@ -1618,19 +1607,15 @@ ZI[EXTENDED_GLOB]="" setopt extendedglob nullglob warncreateglobal typesetsilent noshortloops local -F2 SECONDS=0 .zi-self-update -q - [[ $2 = restart ]] && \ - +zi-message "{msg2}Restarting the update with the new codebase loaded.{rst}"$'\n' + [[ $2 = restart ]] && +zi-message "{msg2}Restarting the update with the new codebase loaded.{rst}"$'\n' local file integer sum el for file ( "" side install autoload ) { .zi-get-mtime-into "${ZI[BIN_DIR]}/$file.zsh" el; sum+=el } # Reload ZI? - if [[ $2 != restart ]] && (( ZI[mtime] + ZI[mtime-side] + - ZI[mtime-install] + ZI[mtime-autoload] != sum - )) { - +zi-message "{msg2}Detected ❮ ZI ❯ update in another session -" \ - "{pre}reloading ZI{msg2}{…}{rst}" + if [[ $2 != restart ]] && (( ZI[mtime] + ZI[mtime-side] + ZI[mtime-install] + ZI[mtime-autoload] != sum )) { + +zi-message "{msg2}Detected ❮ ZI ❯ update in another session -" "{pre}reloading ZI{msg2}{…}{rst}" source $ZI[BIN_DIR]/zi.zsh source $ZI[BIN_DIR]/lib/zsh/side.zsh source $ZI[BIN_DIR]/lib/zsh/install.zsh @@ -1660,13 +1645,10 @@ ZI[EXTENDED_GLOB]="" if (( OPTS[opt_-s,--snippets] || !OPTS[opt_-l,--plugins] )) { local -a snipps snipps=( ${ZI[SNIPPETS_DIR]}/**/(._zi|._zi|._zplugin)(ND) ) - [[ $st != status && ${OPTS[opt_-q,--quiet]} != 1 && -n $snipps ]] && \ - +zi-message "{info}Note:{rst} updating also unloaded snippets" + [[ $st != status && ${OPTS[opt_-q,--quiet]} != 1 && -n $snipps ]] && +zi-message "{info}Note:{rst} updating also unloaded snippets" for snip ( ${ZI[SNIPPETS_DIR]}/**/(._zi|._zi|._zplugin)/mode(D) ) { [[ ! -f ${snip:h}/url ]] && continue - [[ -f ${snip:h}/id-as ]] && \ - id_as="$(<${snip:h}/id-as)" || \ - id_as= + [[ -f ${snip:h}/id-as ]] && id_as="$(<${snip:h}/id-as)" || id_as= .zi-update-or-status-snippet "$st" "${id_as:-$(<${snip:h}/url)}" ICE=() } @@ -1677,11 +1659,9 @@ ZI[EXTENDED_GLOB]="" return } if [[ $st = status ]]; then - (( !OPTS[opt_-q,--quiet] )) && \ - +zi-message "{info}Note:{rst} status done also for unloaded plugins" + (( !OPTS[opt_-q,--quiet] )) && +zi-message "{info}Note:{rst} status done also for unloaded plugins" else - (( !OPTS[opt_-q,--quiet] )) && \ - +zi-message "{info}Note:{rst} updating also unloaded plugins" + (( !OPTS[opt_-q,--quiet] )) && +zi-message "{info}Note:{rst} updating also unloaded plugins" fi ZI[first-plugin-mark]=init for repo in ${ZI[PLUGINS_DIR]}/*; do @@ -1695,9 +1675,8 @@ ZI[EXTENDED_GLOB]="" config=( ${(f)"$(<$repo/.git/config)"} ) if [[ ${#${(M)config[@]:#\[remote[[:blank:]]*\]}} -eq 0 ]]; then if (( !OPTS[opt_-q,--quiet] )) { - [[ $pd = _local---* ]] && \ - builtin print -- "\nSkipping local plugin $REPLY" || \ - builtin print "\n$REPLY doesn't have a remote set, will not fetch" + [[ $pd = _local---* ]] && builtin print -- "\nSkipping local plugin $REPLY" || \ + builtin print "\n$REPLY doesn't have a remote set, will not fetch" } continue fi @@ -1726,16 +1705,12 @@ ZI[EXTENDED_GLOB]="" # FUNCTION: .zi-update-in-parallel [[[ .zi-update-all-parallel() { emulate -LR zsh - setopt extendedglob warncreateglobal typesetsilent \ - noshortloops nomonitor nonotify - + setopt extendedglob warncreateglobal typesetsilent noshortloops nomonitor nonotify local id_as repo snip uspl user plugin PUDIR="$(mktemp -d)" - local -A PUAssocArray map map=( / -- "=" -EQ- "?" -QM- "&" -AMP- : - ) local -a files integer main_counter counter PUPDATE=1 - files=( ${ZI[SNIPPETS_DIR]}/**/(._zi|._zinit|._zplugin)/mode(ND) ) main_counter=${#files} if (( OPTS[opt_-s,--snippets] || !OPTS[opt_-l,--plugins] )) { @@ -1812,17 +1787,13 @@ ZI[EXTENDED_GLOB]="" local ind_file for ind_file ( ${^${(von)PUAssocArray}}.ind(DN.) ) { command cat ${ind_file:r} - (( !OPTS[opt_-d,--debug] && !ZI[DEBUG_MODE] )) && \ - command rm -f $ind_file + (( !OPTS[opt_-d,--debug] && !ZI[DEBUG_MODE] )) && command rm -f $ind_file } - (( !OPTS[opt_-d,--debug] && !ZI[DEBUG_MODE] )) && \ - command rm -f ${(v)PUAssocArray} + (( !OPTS[opt_-d,--debug] && !ZI[DEBUG_MODE] )) && command rm -f ${(v)PUAssocArray} counter=0 PUAssocArray=() } elif (( counter == 1 && !OPTS[opt_-q,--quiet] )) { - +zi-message "{obj}Spawning the next{num}" \ - "${OPTS[value]}{obj} concurrent update jobs" \ - "({msg2}${tpe}{obj}){…}{rst}" + +zi-message "{obj}Spawning the next{num}" "${OPTS[value]}{obj} concurrent update jobs" "({msg2}${tpe}{obj}){…}{rst}" } } # ]]] # FUNCTION: .zi-show-zstatus [[[ @@ -2856,21 +2827,21 @@ EOF builtin print "It is also available probably in all distributions and Homebrew, as package \`tree'" } ( - builtin cd -q "${ZI[SNIPPETS_DIR]}" - local -a list - list=( "${(f@)"$(LANG=en_US.utf-8 tree -L 3 --charset utf-8)"}" ) - # Oh-My-Zsh single file - list=( "${list[@]//(#b)(https--github.com--(ohmyzsh|robbyrussel)l--oh-my-zsh--raw--master(--)(#c0,1)(*))/$ZI[col-info]Oh-My-Zsh$ZI[col-error]${match[2]/--//}$ZI[col-pname]${match[3]//--/$ZI[col-error]/$ZI[col-pname]} $ZI[col-info](single-file)$ZI[col-rst] ${match[1]}}" ) - # Oh-My-Zsh SVN - list=( "${list[@]//(#b)(https--github.com--(ohmyzsh|robbyrussel)l--oh-my-zsh--trunk(--)(#c0,1)(*))/$ZI[col-info]Oh-My-Zsh$ZI[col-error]${match[2]/--//}$ZI[col-pname]${match[3]//--/$ZI[col-error]/$ZI[col-pname]} $ZI[col-info](SVN)$ZI[col-rst] ${match[1]}}" ) - # Prezto single file - list=( "${list[@]//(#b)(https--github.com--sorin-ionescu--prezto--raw--master(--)(#c0,1)(*))/$ZI[col-info]Prezto$ZI[col-error]${match[2]/--//}$ZI[col-pname]${match[3]//--/$ZI[col-error]/$ZI[col-pname]} $ZI[col-info](single-file)$ZI[col-rst] ${match[1]}}" ) - # Prezto SVN - list=( "${list[@]//(#b)(https--github.com--sorin-ionescu--prezto--trunk(--)(#c0,1)(*))/$ZI[col-info]Prezto$ZI[col-error]${match[2]/--//}$ZI[col-pname]${match[3]//--/$ZI[col-error]/$ZI[col-pname]} $ZI[col-info](SVN)$ZI[col-rst] ${match[1]}}" ) - # First-level names - list=( "${list[@]//(#b)(#s)(│   └──| └──| ├──|│   ├──) (*)/${match[1]} $ZI[col-p]${match[2]}$ZI[col-rst]}" ) - list[-1]+=", located at ZI[SNIPPETS_DIR], i.e. ${ZI[SNIPPETS_DIR]}" - builtin print -rl -- "${list[@]}" + builtin cd -q "${ZI[SNIPPETS_DIR]}" + local -a list + list=( "${(f@)"$(LANG=en_US.utf-8 tree -L 3 --charset utf-8)"}" ) + # Oh-My-Zsh single file + list=( "${list[@]//(#b)(https--github.com--(ohmyzsh|robbyrussel)l--oh-my-zsh--raw--master(--)(#c0,1)(*))/$ZI[col-info]Oh-My-Zsh$ZI[col-error]${match[2]/--//}$ZI[col-pname]${match[3]//--/$ZI[col-error]/$ZI[col-pname]} $ZI[col-info](single-file)$ZI[col-rst] ${match[1]}}" ) + # Oh-My-Zsh SVN + list=( "${list[@]//(#b)(https--github.com--(ohmyzsh|robbyrussel)l--oh-my-zsh--trunk(--)(#c0,1)(*))/$ZI[col-info]Oh-My-Zsh$ZI[col-error]${match[2]/--//}$ZI[col-pname]${match[3]//--/$ZI[col-error]/$ZI[col-pname]} $ZI[col-info](SVN)$ZI[col-rst] ${match[1]}}" ) + # Prezto single file + list=( "${list[@]//(#b)(https--github.com--sorin-ionescu--prezto--raw--master(--)(#c0,1)(*))/$ZI[col-info]Prezto$ZI[col-error]${match[2]/--//}$ZI[col-pname]${match[3]//--/$ZI[col-error]/$ZI[col-pname]} $ZI[col-info](single-file)$ZI[col-rst] ${match[1]}}" ) + # Prezto SVN + list=( "${list[@]//(#b)(https--github.com--sorin-ionescu--prezto--trunk(--)(#c0,1)(*))/$ZI[col-info]Prezto$ZI[col-error]${match[2]/--//}$ZI[col-pname]${match[3]//--/$ZI[col-error]/$ZI[col-pname]} $ZI[col-info](SVN)$ZI[col-rst] ${match[1]}}" ) + # First-level names + list=( "${list[@]//(#b)(#s)(│   └──| └──| ├──|│   ├──) (*)/${match[1]} $ZI[col-p]${match[2]}$ZI[col-rst]}" ) + list[-1]+=", located at ZI[SNIPPETS_DIR], i.e. ${ZI[SNIPPETS_DIR]}" + builtin print -rl -- "${list[@]}" ) } # ]]] # FUNCTION: .zi-get-path [[[ @@ -2879,17 +2850,14 @@ EOF .zi-get-path() { emulate -LR zsh setopt extendedglob warncreateglobal typesetsilent noshortloops - [[ $1 == % ]] && local id_as=%$2 || local id_as=$1${1:+/}$2 - .zi-get-object-path snippet "$id_as" || \ - .zi-get-object-path plugin "$id_as" + .zi-get-object-path snippet "$id_as" || .zi-get-object-path plugin "$id_as" return $(( 1 - reply[3] )) } # ]]] # FUNCTION: .zi-recall [[[ .zi-recall() { emulate -LR zsh setopt extendedglob warncreateglobal typesetsilent noshortloops - local -A ice local el val cand1 cand2 local_dir filename is_snippet local -a ice_order nval_ices output @@ -2899,14 +2867,13 @@ EOF ${(@)${(@Akons:|:u)${ZI_EXTS[ice-mods]//\'\'/}}/(#s)<->-/} ) nval_ices=( - ${(s.|.)ZI[nval-ice-list]} - # Include only those additional ices, don't have the '' in their name, i.e. aren't designed to hold value - ${(@)${(@)${(@Akons:|:u)ZI_EXTS[ice-mods]}:#*\'\'*}/(#s)<->-/} - # Must be last - svn + ${(s.|.)ZI[nval-ice-list]} + # Include only those additional ices, don't have the '' in their name, i.e. aren't designed to hold value + ${(@)${(@)${(@Akons:|:u)ZI_EXTS[ice-mods]}:#*\'\'*}/(#s)<->-/} + # Must be last + svn ) - .zi-compute-ice "$1${${1:#(%|/)*}:+${2:+/}}$2" "pack" \ - ice local_dir filename is_snippet || return 1 + .zi-compute-ice "$1${${1:#(%|/)*}:+${2:+/}}$2" "pack" ice local_dir filename is_snippet || return 1 [[ -e $local_dir ]] && { for el ( ${ice_order[@]} ) { val="${ice[$el]}" @@ -2925,8 +2892,7 @@ EOF fi +zi-deploy-message @rst } || builtin print -r -- "No such plugin or snippet" -} -# ]]] +} # ]]] # FUNCTION: .zi-module [[[ # Function that has sub-commands passed as long-options (with two dashes, --). # It's an attempt to plugin only this one function into `zi' function @@ -2956,8 +2922,7 @@ EOF builtin print -r "to be run. To display the instructions on loading the module, run:" builtin print -r "\`zi module info'." fi -} -# ]]] +} # ]]] # FUNCTION: .zi-build-module [[[ # Performs ./configure && make on the module and displays information how to load the module in .zshrc. .zi-build-module() { From d4ca987d83bc5840cc2907fa430ecc8140030961 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 10:03:24 +0000 Subject: [PATCH 02/38] temp compatibility increase --- .gitignore | 1 + zi.zsh | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 40476bf5..e413f417 100644 --- a/.gitignore +++ b/.gitignore @@ -192,3 +192,4 @@ zmodules/Test/*.tmp NEWS.md .gitignore Untitled-1.sh +TEMP.md diff --git a/zi.zsh b/zi.zsh index 83cee41c..f3c0675c 100755 --- a/zi.zsh +++ b/zi.zsh @@ -13,8 +13,10 @@ typeset -gAH ZI ZI_SNIPPETS ZI_REPORTS ZI_ICES ZI_SICE ZI_CUR_BIND_MAP ZI_EXTS Z typeset -gaH ZI_COMPDEF_REPLAY # Compatibility for previous versions. typeset -gAH ZINIT ZPLGM -ZI=( "${(kv)ZINIT[@]}" "${(kv)ZI[@]}" ) -ZI=( "${(kv)ZPLGM[@]}" "${(kv)ZI[@]}" ) +ZI=( + "${(kv)ZINIT[@]}" "${(kv)ZI[@]}" + "${(kv)ZPLGM[@]}" "${(kv)ZI[@]}" + ) unset ZINIT ZPLGM # From fc5788aa7de63bcca9e06144e89456838e645303 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 10:04:01 +0000 Subject: [PATCH 03/38] Links to wiki --- docs/README.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/README.md b/docs/README.md index 46b9f19d..4aaf7096 100644 --- a/docs/README.md +++ b/docs/README.md @@ -32,7 +32,6 @@ Nightly Release - [Interactive install](#interactive-install) - [Quick install](#quick-install) - [Manual install](#manual-install) -- [Usage](#usage) - [Documentation](#documentation) - [Contributing](#contributing) - [Authors & contributors](#authors--contributors) @@ -96,13 +95,9 @@ autoload -Uz _zi (( ${+_comps} )) && _comps[zi]=_zi ``` -## Usage - -All usage information available [**here**](https://github.com/z-shell/zi/wiki/Usage). If you know how we could improve it, please let us know. We highly appreciated any feedback. - ## Documentation -All [documentation](https://github.com/z-shell/zi/wiki) can be viewed on our wiki pages. +All [documentation](https://github.com/z-shell/zi/wiki) can be viewed on our wiki pages. If you know how we could improve it, please let us know. We highly appreciated any feedback. ## Contributing From ac3d4461d971e090922f4d6fefc84f2fdad438d8 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 10:06:40 +0000 Subject: [PATCH 04/38] deleted: lib/templates/p10k --- lib/templates/p10k | 1618 -------------------------------------------- 1 file changed, 1618 deletions(-) delete mode 100755 lib/templates/p10k diff --git a/lib/templates/p10k b/lib/templates/p10k deleted file mode 100755 index 65cc801b..00000000 --- a/lib/templates/p10k +++ /dev/null @@ -1,1618 +0,0 @@ -# Generated by Powerlevel10k configuration wizard on 2021-11-27 at 23:27 GMT. -# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 54401. -# Wizard options: nerdfont-complete + powerline, small icons, unicode, lean, 24h time, -# 2 lines, disconnected, no frame, compact, many icons, concise, transient_prompt, -# instant_prompt=quiet. -# Type `p10k configure` to generate another config. -# -# Config for Powerlevel10k with lean prompt style. Type `p10k configure` to generate -# your own config based on it. -# -# Tip: Looking for a nice color? Here's a one-liner to print colormap. -# -# for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done - -# Temporarily change options. -'builtin' 'local' '-a' 'p10k_config_opts' -[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases') -[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob') -[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand') -'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' - -() { - emulate -L zsh -o extended_glob - - # Unset all configuration options. This allows you to apply configuration changes without - # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. - unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR' - - # Zsh >= 5.1 is required. - autoload -Uz is-at-least && is-at-least 5.1 || return - - # The list of segments shown on the left. Fill it with the most important segments. - typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( - # =========================[ Line #1 ]========================= - os_icon # os identifier - dir # current directory - vcs # git status - # =========================[ Line #2 ]========================= - newline # \n - prompt_char # prompt symbol - ) - - # The list of segments shown on the right. Fill it with less important segments. - # Right prompt on the last prompt line (where you are typing your commands) gets - # automatically hidden when the input line reaches it. Right prompt above the - # last prompt line gets hidden if it would overlap with left prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( - # =========================[ Line #1 ]========================= - status # exit code of the last command - command_execution_time # duration of the last command - background_jobs # presence of background jobs - direnv # direnv status (https://direnv.net/) - asdf # asdf version manager (https://github.com/asdf-vm/asdf) - virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) - anaconda # conda environment (https://conda.io/) - pyenv # python environment (https://github.com/pyenv/pyenv) - goenv # go environment (https://github.com/syndbg/goenv) - nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv) - nvm # node.js version from nvm (https://github.com/nvm-sh/nvm) - nodeenv # node.js environment (https://github.com/ekalinin/nodeenv) - # node_version # node.js version - # go_version # go version (https://golang.org) - # rust_version # rustc version (https://www.rust-lang.org) - # dotnet_version # .NET version (https://dotnet.microsoft.com) - # php_version # php version (https://www.php.net/) - # laravel_version # laravel php framework version (https://laravel.com/) - # java_version # java version (https://www.java.com/) - # package # name@version from package.json (https://docs.npmjs.com/files/package.json) - rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv) - rvm # ruby version from rvm (https://rvm.io) - fvm # flutter version management (https://github.com/leoafarias/fvm) - luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv) - jenv # java version from jenv (https://github.com/jenv/jenv) - plenv # perl version from plenv (https://github.com/tokuhirom/plenv) - phpenv # php version from phpenv (https://github.com/phpenv/phpenv) - scalaenv # scala version from scalaenv (https://github.com/scalaenv/scalaenv) - haskell_stack # haskell version from stack (https://haskellstack.org/) - kubecontext # current kubernetes context (https://kubernetes.io/) - terraform # terraform workspace (https://www.terraform.io) - # terraform_version # terraform version (https://www.terraform.io) - aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) - aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) - azure # azure account name (https://docs.microsoft.com/en-us/cli/azure) - gcloud # google cloud cli account and project (https://cloud.google.com/) - google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production) - toolbox # toolbox name (https://github.com/containers/toolbox) - context # user@hostname - nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) - ranger # ranger shell (https://github.com/ranger/ranger) - nnn # nnn shell (https://github.com/jarun/nnn) - xplr # xplr shell (https://github.com/sayanarijit/xplr) - vim_shell # vim shell indicator (:sh) - midnight_commander # midnight commander shell (https://midnight-commander.org/) - nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) - # vpn_ip # virtual private network indicator - # load # CPU load - # disk_usage # disk usage - # ram # free RAM - # swap # used swap - todo # todo items (https://github.com/todotxt/todo.txt-cli) - timewarrior # timewarrior tracking status (https://timewarrior.net/) - taskwarrior # taskwarrior task count (https://taskwarrior.org/) - time # current time - # =========================[ Line #2 ]========================= - newline - # ip # ip address and bandwidth usage for a specified network interface - # public_ip # public IP address - # proxy # system-wide http/https/ftp proxy - # battery # internal battery - # wifi # wifi speed - # example # example user-defined segment (see prompt_example function below) - ) - - # Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you. - typeset -g POWERLEVEL9K_MODE=nerdfont-complete - # When set to `moderate`, some icons will have an extra space after them. This is meant to avoid - # icon overlap when using non-monospace fonts. When set to `none`, spaces are not added. - typeset -g POWERLEVEL9K_ICON_PADDING=none - - # Basic style options that define the overall look of your prompt. You probably don't want to - # change them. - typeset -g POWERLEVEL9K_BACKGROUND= # transparent background - typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace - typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space - typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol - - # When set to true, icons appear before content on both sides of the prompt. When set - # to false, icons go after content. If empty or not set, icons go before content in the left - # prompt and after content in the right prompt. - # - # You can also override it for a specific segment: - # - # POWERLEVEL9K_STATUS_ICON_BEFORE_CONTENT=false - # - # Or for a specific segment in specific state: - # - # POWERLEVEL9K_DIR_NOT_WRITABLE_ICON_BEFORE_CONTENT=false - typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT=true - - # Add an empty line before each prompt. - typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false - - # Connect left prompt lines with these symbols. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX= - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX= - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX= - # Connect right prompt lines with these symbols. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX= - typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX= - typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX= - - # The left end of left prompt. - typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= - # The right end of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL= - - # Ruler, a.k.a. the horizontal line before each prompt. If you set it to true, you'll - # probably want to set POWERLEVEL9K_PROMPT_ADD_NEWLINE=false above and - # POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' below. - typeset -g POWERLEVEL9K_SHOW_RULER=false - typeset -g POWERLEVEL9K_RULER_CHAR='─' # reasonable alternative: '·' - typeset -g POWERLEVEL9K_RULER_FOREGROUND=242 - - # Filler between left and right prompt on the first prompt line. You can set it to '·' or '─' - # to make it easier to see the alignment between left and right prompt and to separate prompt - # from command output. It serves the same purpose as ruler (see above) without increasing - # the number of prompt lines. You'll probably want to set POWERLEVEL9K_SHOW_RULER=false - # if using this. You might also like POWERLEVEL9K_PROMPT_ADD_NEWLINE=false for more compact - # prompt. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' - if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then - # The color of the filler. - typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=242 - # Add a space between the end of left prompt and the filler. - typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=' ' - # Add a space between the filler and the start of right prompt. - typeset -g POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL=' ' - # Start filler from the edge of the screen if there are no left segments on the first line. - typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_FIRST_SEGMENT_END_SYMBOL='%{%}' - # End filler on the edge of the screen if there are no right segments on the first line. - typeset -g POWERLEVEL9K_EMPTY_LINE_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='%{%}' - fi - - #################################[ os_icon: os identifier ]################################## - # OS identifier color. - typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND= - # Custom icon. - # typeset -g POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='⭐' - - ################################[ prompt_char: prompt symbol ]################################ - # Green prompt symbol if the last command succeeded. - typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=76 - # Red prompt symbol if the last command failed. - typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=196 - # Default prompt symbol. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯' - # Prompt symbol in command vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮' - # Prompt symbol in visual vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='V' - # Prompt symbol in overwrite vi mode. - typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='▶' - typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true - # No line terminator if prompt_char is the last segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='' - # No line introducer if prompt_char is the first segment. - typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL= - - ##################################[ dir: current directory ]################################## - # Default current directory color. - typeset -g POWERLEVEL9K_DIR_FOREGROUND=31 - # If directory is too long, shorten some of its segments to the shortest possible unique - # prefix. The shortened directory can be tab-completed to the original. - typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique - # Replace removed segment suffixes with this symbol. - typeset -g POWERLEVEL9K_SHORTEN_DELIMITER= - # Color of the shortened directory segments. - typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=103 - # Color of the anchor directory segments. Anchor segments are never shortened. The first - # segment is always an anchor. - typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=39 - # Display anchor directory segments in bold. - typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=true - # Don't shorten directories that contain any of these files. They are anchors. - local anchor_files=( - .bzr - .citc - .git - .hg - .node-version - .python-version - .go-version - .ruby-version - .lua-version - .java-version - .perl-version - .php-version - .tool-version - .shorten_folder_marker - .svn - .terraform - CVS - Cargo.toml - composer.json - go.mod - package.json - stack.yaml - ) - typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})" - # If set to "first" ("last"), remove everything before the first (last) subdirectory that contains - # files matching $POWERLEVEL9K_SHORTEN_FOLDER_MARKER. For example, when the current directory is - # /foo/bar/git_repo/nested_git_repo/baz, prompt will display git_repo/nested_git_repo/baz (first) - # or nested_git_repo/baz (last). This assumes that git_repo and nested_git_repo contain markers - # and other directories don't. - # - # Optionally, "first" and "last" can be followed by ":" where is an integer. - # This moves the truncation point to the right (positive offset) or to the left (negative offset) - # relative to the marker. Plain "first" and "last" are equivalent to "first:0" and "last:0" - # respectively. - typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false - # Don't shorten this many last directory segments. They are anchors. - typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 - # Shorten directory if it's longer than this even if there is space for it. The value can - # be either absolute (e.g., '80') or a percentage of terminal width (e.g, '50%'). If empty, - # directory will be shortened only when prompt doesn't fit or when other parameters demand it - # (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below). - # If set to `0`, directory will always be shortened to its minimum length. - typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80 - # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this - # many columns for typing commands. - typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40 - # When `dir` segment is on the last prompt line, try to shorten it enough to leave at least - # COLUMNS * POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT * 0.01 columns for typing commands. - typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50 - # If set to true, embed a hyperlink into the directory. Useful for quickly - # opening a directory in the file manager simply by clicking the link. - # Can also be handy when the directory is shortened, as it allows you to see - # the full directory that was used in previous commands. - typeset -g POWERLEVEL9K_DIR_HYPERLINK=false - - # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON - # and POWERLEVEL9K_DIR_CLASSES below. - typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 - - # The default icon shown next to non-writable and non-existent directories when - # POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v3. - # typeset -g POWERLEVEL9K_LOCK_ICON='⭐' - - # POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons and colors for different - # directories. It must be an array with 3 * N elements. Each triplet consists of: - # - # 1. A pattern against which the current directory ($PWD) is matched. Matching is done with - # extended_glob option enabled. - # 2. Directory class for the purpose of styling. - # 3. An empty string. - # - # Triplets are tried in order. The first triplet whose pattern matches $PWD wins. - # - # If POWERLEVEL9K_DIR_SHOW_WRITABLE is set to v3, non-writable and non-existent directories - # acquire class suffix _NOT_WRITABLE and NON_EXISTENT respectively. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_DIR_CLASSES=( - # '~/work(|/*)' WORK '' - # '~(|/*)' HOME '' - # '*' DEFAULT '') - # - # Whenever the current directory is ~/work or a subdirectory of ~/work, it gets styled with one - # of the following classes depending on its writability and existence: WORK, WORK_NOT_WRITABLE or - # WORK_NON_EXISTENT. - # - # Simply assigning classes to directories doesn't have any visible effects. It merely gives you an - # option to define custom colors and icons for different directory classes. - # - # # Styling for WORK. - # typeset -g POWERLEVEL9K_DIR_WORK_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31 - # typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103 - # typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39 - # - # # Styling for WORK_NOT_WRITABLE. - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND=31 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_SHORTENED_FOREGROUND=103 - # typeset -g POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_ANCHOR_FOREGROUND=39 - # - # # Styling for WORK_NON_EXISTENT. - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_FOREGROUND=31 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_SHORTENED_FOREGROUND=103 - # typeset -g POWERLEVEL9K_DIR_WORK_NON_EXISTENT_ANCHOR_FOREGROUND=39 - # - # If a styling parameter isn't explicitly defined for some class, it falls back to the classless - # parameter. For example, if POWERLEVEL9K_DIR_WORK_NOT_WRITABLE_FOREGROUND is not set, it falls - # back to POWERLEVEL9K_DIR_FOREGROUND. - # - # typeset -g POWERLEVEL9K_DIR_CLASSES=() - - # Custom prefix. - # typeset -g POWERLEVEL9K_DIR_PREFIX='%fin ' - - #####################################[ vcs: git status ]###################################### - # Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon. - typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\uF126 ' - - # Untracked files icon. It's really a question mark, your font isn't broken. - # Change the value of this parameter to show a different icon. - typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?' - - # Formatter for Git status. - # - # Example output: master wip ⇣42⇡42 *42 merge ~42 +42 !42 ?42. - # - # You can edit the function to customize how Git status looks. - # - # VCS_STATUS_* parameters are set by gitstatus plugin. See reference: - # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh. - function my_git_formatter() { - emulate -L zsh - - if [[ -n $P9K_CONTENT ]]; then - # If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from - # gitstatus plugin). VCS_STATUS_* parameters are not available in this case. - typeset -g my_git_format=$P9K_CONTENT - return - fi - - if (( $1 )); then - # Styling for up-to-date Git status. - local meta='%f' # default foreground - local clean='%76F' # green foreground - local modified='%178F' # yellow foreground - local untracked='%39F' # blue foreground - local conflicted='%196F' # red foreground - else - # Styling for incomplete and stale Git status. - local meta='%244F' # grey foreground - local clean='%244F' # grey foreground - local modified='%244F' # grey foreground - local untracked='%244F' # grey foreground - local conflicted='%244F' # grey foreground - fi - - local res - - if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then - local branch=${(V)VCS_STATUS_LOCAL_BRANCH} - # If local branch name is at most 32 characters long, show it in full. - # Otherwise show the first 12 … the last 12. - # Tip: To always show local branch name in full without truncation, delete the next line. - (( $#branch > 32 )) && branch[13,-13]="…" # <-- this line - res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}${branch//\%/%%}" - fi - - if [[ -n $VCS_STATUS_TAG - # Show tag only if not on a branch. - # Tip: To always show tag, delete the next line. - && -z $VCS_STATUS_LOCAL_BRANCH # <-- this line - ]]; then - local tag=${(V)VCS_STATUS_TAG} - # If tag name is at most 32 characters long, show it in full. - # Otherwise show the first 12 … the last 12. - # Tip: To always show tag name in full without truncation, delete the next line. - (( $#tag > 32 )) && tag[13,-13]="…" # <-- this line - res+="${meta}#${clean}${tag//\%/%%}" - fi - - # Display the current Git commit if there is no branch and no tag. - # Tip: To always display the current Git commit, delete the next line. - [[ -z $VCS_STATUS_LOCAL_BRANCH && -z $VCS_STATUS_TAG ]] && # <-- this line - res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}" - - # Show tracking branch name if it differs from local branch. - if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then - res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" - fi - - # Display "wip" if the latest commit's summary contains "wip" or "WIP". - if [[ $VCS_STATUS_COMMIT_SUMMARY == (|*[^[:alnum:]])(wip|WIP)(|[^[:alnum:]]*) ]]; then - res+=" ${modified}wip" - fi - - # ⇣42 if behind the remote. - (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}⇣${VCS_STATUS_COMMITS_BEHIND}" - # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42. - (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" " - (( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}⇡${VCS_STATUS_COMMITS_AHEAD}" - # ⇠42 if behind the push remote. - (( VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" ${clean}⇠${VCS_STATUS_PUSH_COMMITS_BEHIND}" - (( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" " - # ⇢42 if ahead of the push remote; no leading space if also behind: ⇠42⇢42. - (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}⇢${VCS_STATUS_PUSH_COMMITS_AHEAD}" - # *42 if have stashes. - (( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}" - # 'merge' if the repo is in an unusual state. - [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}" - # ~42 if have merge conflicts. - (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}" - # +42 if have staged changes. - (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}" - # !42 if have unstaged changes. - (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}" - # ?42 if have untracked files. It's really a question mark, your font isn't broken. - # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon. - # Remove the next line if you don't want to see untracked files at all. - (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}" - # "─" if the number of unstaged files is unknown. This can happen due to - # POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY (see below) being set to a non-negative number lower - # than the number of files in the Git index, or due to bash.showDirtyState being set to false - # in the repository config. The number of staged and untracked files may also be unknown - # in this case. - (( VCS_STATUS_HAS_UNSTAGED == -1 )) && res+=" ${modified}─" - - typeset -g my_git_format=$res - } - functions -M my_git_formatter 2>/dev/null - - # Don't count the number of unstaged, untracked and conflicted files in Git repositories with - # more than this many files in the index. Negative value means infinity. - # - # If you are working in Git repositories with tens of millions of files and seeing performance - # sagging, try setting POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY to a number lower than the output - # of `git ls-files | wc -l`. Alternatively, add `bash.showDirtyState = false` to the repository's - # config: `git config bash.showDirtyState false`. - typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1 - - # Don't show Git status in prompt for repositories whose workdir matches this pattern. - # For example, if set to '~', the Git repository at $HOME/.git will be ignored. - # Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'. - typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~' - - # Disable the default Git status formatting. - typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true - # Install our own Git status formatter. - typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}' - typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}' - # Enable counters for staged, unstaged, etc. - typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1 - - # Icon color. - typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=76 - typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR=244 - # Custom icon. - # typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION='⭐' - # Custom prefix. - # typeset -g POWERLEVEL9K_VCS_PREFIX='%fon ' - - # Show status of repositories of these types. You can add svn and/or hg if you are - # using them. If you do, your prompt may become slow even when your current directory - # isn't in an svn or hg reposotiry. - typeset -g POWERLEVEL9K_VCS_BACKENDS=(git) - - # These settings are used for repositories other than Git or when gitstatusd fails and - # Powerlevel10k has to fall back to using vcs_info. - typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=76 - typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=76 - typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=178 - - ##########################[ status: exit code of the last command ]########################### - # Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and - # style them independently from the regular OK and ERROR state. - typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true - - # Status on success. No content, just an icon. No need to show it if prompt_char is enabled as - # it will signify success by turning green. - typeset -g POWERLEVEL9K_STATUS_OK=false - typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=70 - typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION='✔' - - # Status when some part of a pipe command fails but the overall exit status is zero. It may look - # like this: 1|0. - typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=70 - typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION='✔' - - # Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as - # it will signify error by turning red. - typeset -g POWERLEVEL9K_STATUS_ERROR=false - typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=160 - typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='✘' - - # Status when the last command was terminated by a signal. - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=160 - # Use terse signal names: "INT" instead of "SIGINT(2)". - typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false - typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION='✘' - - # Status when some part of a pipe command fails and the overall exit status is also non-zero. - # It may look like this: 1|0. - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=160 - typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION='✘' - - ###################[ command_execution_time: duration of the last command ]################### - # Show duration of the last command if takes at least this many seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 - # Show this many fractional digits. Zero means round to seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 - # Execution time color. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101 - # Duration format: 1d 2h 3m 4s. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s' - # Custom icon. - # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION='⭐' - # Custom prefix. - # typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='%ftook ' - - #######################[ background_jobs: presence of background jobs ]####################### - # Don't show the number of background jobs. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false - # Background jobs color. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=70 - # Custom icon. - # typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######################[ direnv: direnv status (https://direnv.net/) ]######################## - # Direnv color. - typeset -g POWERLEVEL9K_DIRENV_FOREGROUND=178 - # Custom icon. - # typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ asdf: asdf version manager (https://github.com/asdf-vm/asdf) ]############### - # Default asdf color. Only used to display tools for which there is no color override (see below). - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_FOREGROUND. - typeset -g POWERLEVEL9K_ASDF_FOREGROUND=66 - - # There are four parameters that can be used to hide asdf tools. Each parameter describes - # conditions under which a tool gets hidden. Parameters can hide tools but not unhide them. If at - # least one parameter decides to hide a tool, that tool gets hidden. If no parameter decides to - # hide a tool, it gets shown. - # - # Special note on the difference between POWERLEVEL9K_ASDF_SOURCES and - # POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW. Consider the effect of the following commands: - # - # asdf local python 3.8.1 - # asdf global python 3.8.1 - # - # After running both commands the current python version is 3.8.1 and its source is "local" as - # it takes precedence over "global". If POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW is set to false, - # it'll hide python version in this case because 3.8.1 is the same as the global version. - # POWERLEVEL9K_ASDF_SOURCES will hide python version only if the value of this parameter doesn't - # contain "local". - - # Hide tool versions that don't come from one of these sources. - # - # Available sources: - # - # - shell `asdf current` says "set by ASDF_${TOOL}_VERSION environment variable" - # - local `asdf current` says "set by /some/not/home/directory/file" - # - global `asdf current` says "set by /home/username/file" - # - # Note: If this parameter is set to (shell local global), it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SOURCES. - typeset -g POWERLEVEL9K_ASDF_SOURCES=(shell local global) - - # If set to false, hide tool versions that are the same as global. - # - # Note: The name of this parameter doesn't reflect its meaning at all. - # Note: If this parameter is set to true, it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_PROMPT_ALWAYS_SHOW. - typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=false - - # If set to false, hide tool versions that are equal to "system". - # - # Note: If this parameter is set to true, it won't hide tools. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_SYSTEM. - typeset -g POWERLEVEL9K_ASDF_SHOW_SYSTEM=true - - # If set to non-empty value, hide tools unless there is a file matching the specified file pattern - # in the current directory, or its parent directory, or its grandparent directory, and so on. - # - # Note: If this parameter is set to empty value, it won't hide tools. - # Note: SHOW_ON_UPGLOB isn't specific to asdf. It works with all prompt segments. - # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_ON_UPGLOB. - # - # Example: Hide nodejs version when there is no package.json and no *.js files in the current - # directory, in `..`, in `../..` and so on. - # - # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.js|package.json' - typeset -g POWERLEVEL9K_ASDF_SHOW_ON_UPGLOB= - - # Ruby version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=168 - # typeset -g POWERLEVEL9K_ASDF_RUBY_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_RUBY_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Python version from asdf. - typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=37 - # typeset -g POWERLEVEL9K_ASDF_PYTHON_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PYTHON_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Go version from asdf. - typeset -g POWERLEVEL9K_ASDF_GOLANG_FOREGROUND=37 - # typeset -g POWERLEVEL9K_ASDF_GOLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_GOLANG_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Node.js version from asdf. - typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=70 - # typeset -g POWERLEVEL9K_ASDF_NODEJS_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_NODEJS_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Rust version from asdf. - typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=37 - # typeset -g POWERLEVEL9K_ASDF_RUST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_RUST_SHOW_ON_UPGLOB='*.foo|*.bar' - - # .NET Core version from asdf. - typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=134 - # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_DOTNET_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Flutter version from asdf. - typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=38 - # typeset -g POWERLEVEL9K_ASDF_FLUTTER_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_FLUTTER_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Lua version from asdf. - typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=32 - # typeset -g POWERLEVEL9K_ASDF_LUA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_LUA_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Java version from asdf. - typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=32 - # typeset -g POWERLEVEL9K_ASDF_JAVA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_JAVA_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Perl version from asdf. - typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=67 - # typeset -g POWERLEVEL9K_ASDF_PERL_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PERL_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Erlang version from asdf. - typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=125 - # typeset -g POWERLEVEL9K_ASDF_ERLANG_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_ERLANG_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Elixir version from asdf. - typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=129 - # typeset -g POWERLEVEL9K_ASDF_ELIXIR_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_ELIXIR_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Postgres version from asdf. - typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=31 - # typeset -g POWERLEVEL9K_ASDF_POSTGRES_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_POSTGRES_SHOW_ON_UPGLOB='*.foo|*.bar' - - # PHP version from asdf. - typeset -g POWERLEVEL9K_ASDF_PHP_FOREGROUND=99 - # typeset -g POWERLEVEL9K_ASDF_PHP_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_PHP_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Haskell version from asdf. - typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=172 - # typeset -g POWERLEVEL9K_ASDF_HASKELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_HASKELL_SHOW_ON_UPGLOB='*.foo|*.bar' - - # Julia version from asdf. - typeset -g POWERLEVEL9K_ASDF_JULIA_FOREGROUND=70 - # typeset -g POWERLEVEL9K_ASDF_JULIA_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_ASDF_JULIA_SHOW_ON_UPGLOB='*.foo|*.bar' - - ##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]########### - # NordVPN connection indicator color. - typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=39 - # Hide NordVPN connection indicator when not connected. - typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_CONTENT_EXPANSION= - typeset -g POWERLEVEL9K_NORDVPN_{DISCONNECTED,CONNECTING,DISCONNECTING}_VISUAL_IDENTIFIER_EXPANSION= - # Custom icon. - # typeset -g POWERLEVEL9K_NORDVPN_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #################[ ranger: ranger shell (https://github.com/ranger/ranger) ]################## - # Ranger shell color. - typeset -g POWERLEVEL9K_RANGER_FOREGROUND=178 - # Custom icon. - # typeset -g POWERLEVEL9K_RANGER_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######################[ nnn: nnn shell (https://github.com/jarun/nnn) ]####################### - # Nnn shell color. - typeset -g POWERLEVEL9K_NNN_FOREGROUND=72 - # Custom icon. - # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##################[ xplr: xplr shell (https://github.com/sayanarijit/xplr) ]################## - # xplr shell color. - typeset -g POWERLEVEL9K_XPLR_FOREGROUND=72 - # Custom icon. - # typeset -g POWERLEVEL9K_XPLR_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########################[ vim_shell: vim shell indicator (:sh) ]########################### - # Vim shell indicator color. - typeset -g POWERLEVEL9K_VIM_SHELL_FOREGROUND=34 - # Custom icon. - # typeset -g POWERLEVEL9K_VIM_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######[ midnight_commander: midnight commander shell (https://midnight-commander.org/) ]###### - # Midnight Commander shell color. - typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_FOREGROUND=178 - # Custom icon. - # typeset -g POWERLEVEL9K_MIDNIGHT_COMMANDER_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #[ nix_shell: nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) ]## - # Nix shell color. - typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74 - - # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. - # typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION= - - # Custom icon. - # typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##################################[ disk_usage: disk usage ]################################## - # Colors for different levels of disk usage. - typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35 - typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_FOREGROUND=220 - typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_FOREGROUND=160 - # Thresholds for different levels of disk usage (percentage points). - typeset -g POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90 - typeset -g POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95 - # If set to true, hide disk usage when below $POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL percent. - typeset -g POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false - # Custom icon. - # typeset -g POWERLEVEL9K_DISK_USAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######################################[ ram: free RAM ]####################################### - # RAM color. - typeset -g POWERLEVEL9K_RAM_FOREGROUND=66 - # Custom icon. - # typeset -g POWERLEVEL9K_RAM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################################[ swap: used swap ]###################################### - # Swap color. - typeset -g POWERLEVEL9K_SWAP_FOREGROUND=96 - # Custom icon. - # typeset -g POWERLEVEL9K_SWAP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ######################################[ load: CPU load ]###################################### - # Show average CPU load over this many last minutes. Valid values are 1, 5 and 15. - typeset -g POWERLEVEL9K_LOAD_WHICH=5 - # Load color when load is under 50%. - typeset -g POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=66 - # Load color when load is between 50% and 70%. - typeset -g POWERLEVEL9K_LOAD_WARNING_FOREGROUND=178 - # Load color when load is over 70%. - typeset -g POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=166 - # Custom icon. - # typeset -g POWERLEVEL9K_LOAD_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ todo: todo items (https://github.com/todotxt/todo.txt-cli) ]################ - # Todo color. - typeset -g POWERLEVEL9K_TODO_FOREGROUND=110 - # Hide todo when the total number of tasks is zero. - typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_TOTAL=true - # Hide todo when the number of tasks after filtering is zero. - typeset -g POWERLEVEL9K_TODO_HIDE_ZERO_FILTERED=false - - # Todo format. The following parameters are available within the expansion. - # - # - P9K_TODO_TOTAL_TASK_COUNT The total number of tasks. - # - P9K_TODO_FILTERED_TASK_COUNT The number of tasks after filtering. - # - # These variables correspond to the last line of the output of `todo.sh -p ls`: - # - # TODO: 24 of 42 tasks shown - # - # Here 24 is P9K_TODO_FILTERED_TASK_COUNT and 42 is P9K_TODO_TOTAL_TASK_COUNT. - # - # typeset -g POWERLEVEL9K_TODO_CONTENT_EXPANSION='$P9K_TODO_FILTERED_TASK_COUNT' - - # Custom icon. - # typeset -g POWERLEVEL9K_TODO_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ timewarrior: timewarrior tracking status (https://timewarrior.net/) ]############ - # Timewarrior color. - typeset -g POWERLEVEL9K_TIMEWARRIOR_FOREGROUND=110 - # If the tracked task is longer than 24 characters, truncate and append "…". - # Tip: To always display tasks without truncation, delete the following parameter. - # Tip: To hide task names and display just the icon when time tracking is enabled, set the - # value of the following parameter to "". - typeset -g POWERLEVEL9K_TIMEWARRIOR_CONTENT_EXPANSION='${P9K_CONTENT:0:24}${${P9K_CONTENT:24}:+…}' - - # Custom icon. - # typeset -g POWERLEVEL9K_TIMEWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############[ taskwarrior: taskwarrior task count (https://taskwarrior.org/) ]############## - # Taskwarrior color. - typeset -g POWERLEVEL9K_TASKWARRIOR_FOREGROUND=74 - - # Taskwarrior segment format. The following parameters are available within the expansion. - # - # - P9K_TASKWARRIOR_PENDING_COUNT The number of pending tasks: `task +PENDING count`. - # - P9K_TASKWARRIOR_OVERDUE_COUNT The number of overdue tasks: `task +OVERDUE count`. - # - # Zero values are represented as empty parameters. - # - # The default format: - # - # '${P9K_TASKWARRIOR_OVERDUE_COUNT:+"!$P9K_TASKWARRIOR_OVERDUE_COUNT/"}$P9K_TASKWARRIOR_PENDING_COUNT' - # - # typeset -g POWERLEVEL9K_TASKWARRIOR_CONTENT_EXPANSION='$P9K_TASKWARRIOR_PENDING_COUNT' - - # Custom icon. - # typeset -g POWERLEVEL9K_TASKWARRIOR_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##################################[ context: user@hostname ]################################## - # Context color when running with privileges. - typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178 - # Context color in SSH without privileges. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_FOREGROUND=180 - # Default context color (no privileges, no SSH). - typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=180 - - # Context format when running with privileges: bold user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%B%n@%m' - # Context format when in SSH without privileges: user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE='%n@%m' - # Default context format (no privileges, no SSH): user@hostname. - typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m' - - # Don't show context unless running with privileges or in SSH. - # Tip: Remove the next line to always show context. - typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION= - - # Custom icon. - # typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐' - # Custom prefix. - # typeset -g POWERLEVEL9K_CONTEXT_PREFIX='%fwith ' - - ###[ virtualenv: python virtual environment (https://docs.python.org/3/library/venv.html) ]### - # Python virtual environment color. - typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=37 - # Don't show Python version next to the virtual environment name. - typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false - # If set to "false", won't show virtualenv if pyenv is already shown. - # If set to "if-different", won't show virtualenv if it's the same as pyenv. - typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=false - # Separate environment name from Python version only with a space. - typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_VIRTUALENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################[ anaconda: conda environment (https://conda.io/) ]###################### - # Anaconda environment color. - typeset -g POWERLEVEL9K_ANACONDA_FOREGROUND=37 - - # Anaconda segment format. The following parameters are available within the expansion. - # - # - CONDA_PREFIX Absolute path to the active Anaconda/Miniconda environment. - # - CONDA_DEFAULT_ENV Name of the active Anaconda/Miniconda environment. - # - CONDA_PROMPT_MODIFIER Configurable prompt modifier (see below). - # - P9K_ANACONDA_PYTHON_VERSION Current python version (python --version). - # - # CONDA_PROMPT_MODIFIER can be configured with the following command: - # - # conda config --set env_prompt '({default_env}) ' - # - # The last argument is a Python format string that can use the following variables: - # - # - prefix The same as CONDA_PREFIX. - # - default_env The same as CONDA_DEFAULT_ENV. - # - name The last segment of CONDA_PREFIX. - # - stacked_env Comma-separated list of names in the environment stack. The first element is - # always the same as default_env. - # - # Note: '({default_env}) ' is the default value of env_prompt. - # - # The default value of POWERLEVEL9K_ANACONDA_CONTENT_EXPANSION expands to $CONDA_PROMPT_MODIFIER - # without the surrounding parentheses, or to the last path component of CONDA_PREFIX if the former - # is empty. - typeset -g POWERLEVEL9K_ANACONDA_CONTENT_EXPANSION='${${${${CONDA_PROMPT_MODIFIER#\(}% }%\)}:-${CONDA_PREFIX:t}}' - - # Custom icon. - # typeset -g POWERLEVEL9K_ANACONDA_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ pyenv: python environment (https://github.com/pyenv/pyenv) ]################ - # Pyenv color. - typeset -g POWERLEVEL9K_PYENV_FOREGROUND=37 - # Hide python version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PYENV_SOURCES=(shell local global) - # If set to false, hide python version if it's the same as global: - # $(pyenv version-name) == $(pyenv global). - typeset -g POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide python version if it's equal to "system". - typeset -g POWERLEVEL9K_PYENV_SHOW_SYSTEM=true - - # Pyenv segment format. The following parameters are available within the expansion. - # - # - P9K_CONTENT Current pyenv environment (pyenv version-name). - # - P9K_PYENV_PYTHON_VERSION Current python version (python --version). - # - # The default format has the following logic: - # - # 1. Display just "$P9K_CONTENT" if it's equal to "$P9K_PYENV_PYTHON_VERSION" or - # starts with "$P9K_PYENV_PYTHON_VERSION/". - # 2. Otherwise display "$P9K_CONTENT $P9K_PYENV_PYTHON_VERSION". - typeset -g POWERLEVEL9K_PYENV_CONTENT_EXPANSION='${P9K_CONTENT}${${P9K_CONTENT:#$P9K_PYENV_PYTHON_VERSION(|/*)}:+ $P9K_PYENV_PYTHON_VERSION}' - - # Custom icon. - # typeset -g POWERLEVEL9K_PYENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################[ goenv: go environment (https://github.com/syndbg/goenv) ]################ - # Goenv color. - typeset -g POWERLEVEL9K_GOENV_FOREGROUND=37 - # Hide go version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_GOENV_SOURCES=(shell local global) - # If set to false, hide go version if it's the same as global: - # $(goenv version-name) == $(goenv global). - typeset -g POWERLEVEL9K_GOENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide go version if it's equal to "system". - typeset -g POWERLEVEL9K_GOENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_GOENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ nodenv: node.js version from nodenv (https://github.com/nodenv/nodenv) ]########## - # Nodenv color. - typeset -g POWERLEVEL9K_NODENV_FOREGROUND=70 - # Hide node version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_NODENV_SOURCES=(shell local global) - # If set to false, hide node version if it's the same as global: - # $(nodenv version-name) == $(nodenv global). - typeset -g POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide node version if it's equal to "system". - typeset -g POWERLEVEL9K_NODENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_NODENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### - # Nvm color. - typeset -g POWERLEVEL9K_NVM_FOREGROUND=70 - # Custom icon. - # typeset -g POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ############[ nodeenv: node.js environment (https://github.com/ekalinin/nodeenv) ]############ - # Nodeenv color. - typeset -g POWERLEVEL9K_NODEENV_FOREGROUND=70 - # Don't show Node version next to the environment name. - typeset -g POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false - # Separate environment name from Node version only with a space. - typeset -g POWERLEVEL9K_NODEENV_{LEFT,RIGHT}_DELIMITER= - # Custom icon. - # typeset -g POWERLEVEL9K_NODEENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##############################[ node_version: node.js version ]############################### - # Node version color. - typeset -g POWERLEVEL9K_NODE_VERSION_FOREGROUND=70 - # Show node version only when in a directory tree containing package.json. - typeset -g POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_NODE_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######################[ go_version: go version (https://golang.org) ]######################## - # Go version color. - typeset -g POWERLEVEL9K_GO_VERSION_FOREGROUND=37 - # Show go version only when in a go project subdirectory. - typeset -g POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_GO_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #################[ rust_version: rustc version (https://www.rust-lang.org) ]################## - # Rust version color. - typeset -g POWERLEVEL9K_RUST_VERSION_FOREGROUND=37 - # Show rust version only when in a rust project subdirectory. - typeset -g POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_RUST_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ dotnet_version: .NET version (https://dotnet.microsoft.com) ]################ - # .NET version color. - typeset -g POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=134 - # Show .NET version only when in a .NET project subdirectory. - typeset -g POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_DOTNET_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #####################[ php_version: php version (https://www.php.net/) ]###################### - # PHP version color. - typeset -g POWERLEVEL9K_PHP_VERSION_FOREGROUND=99 - # Show PHP version only when in a PHP project subdirectory. - typeset -g POWERLEVEL9K_PHP_VERSION_PROJECT_ONLY=true - # Custom icon. - # typeset -g POWERLEVEL9K_PHP_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ laravel_version: laravel php framework version (https://laravel.com/) ]########### - # Laravel version color. - typeset -g POWERLEVEL9K_LARAVEL_VERSION_FOREGROUND=161 - # Custom icon. - # typeset -g POWERLEVEL9K_LARAVEL_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ####################[ java_version: java version (https://www.java.com/) ]#################### - # Java version color. - typeset -g POWERLEVEL9K_JAVA_VERSION_FOREGROUND=32 - # Show java version only when in a java project subdirectory. - typeset -g POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY=true - # Show brief version. - typeset -g POWERLEVEL9K_JAVA_VERSION_FULL=false - # Custom icon. - # typeset -g POWERLEVEL9K_JAVA_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###[ package: name@version from package.json (https://docs.npmjs.com/files/package.json) ]#### - # Package color. - typeset -g POWERLEVEL9K_PACKAGE_FOREGROUND=117 - # Package format. The following parameters are available within the expansion. - # - # - P9K_PACKAGE_NAME The value of `name` field in package.json. - # - P9K_PACKAGE_VERSION The value of `version` field in package.json. - # - # typeset -g POWERLEVEL9K_PACKAGE_CONTENT_EXPANSION='${P9K_PACKAGE_NAME//\%/%%}@${P9K_PACKAGE_VERSION//\%/%%}' - # Custom icon. - # typeset -g POWERLEVEL9K_PACKAGE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #############[ rbenv: ruby version from rbenv (https://github.com/rbenv/rbenv) ]############## - # Rbenv color. - typeset -g POWERLEVEL9K_RBENV_FOREGROUND=168 - # Hide ruby version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_RBENV_SOURCES=(shell local global) - # If set to false, hide ruby version if it's the same as global: - # $(rbenv version-name) == $(rbenv global). - typeset -g POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide ruby version if it's equal to "system". - typeset -g POWERLEVEL9K_RBENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_RBENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######################[ rvm: ruby version from rvm (https://rvm.io) ]######################## - # Rvm color. - typeset -g POWERLEVEL9K_RVM_FOREGROUND=168 - # Don't show @gemset at the end. - typeset -g POWERLEVEL9K_RVM_SHOW_GEMSET=false - # Don't show ruby- at the front. - typeset -g POWERLEVEL9K_RVM_SHOW_PREFIX=false - # Custom icon. - # typeset -g POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ fvm: flutter version management (https://github.com/leoafarias/fvm) ]############ - # Fvm color. - typeset -g POWERLEVEL9K_FVM_FOREGROUND=38 - # Custom icon. - # typeset -g POWERLEVEL9K_FVM_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ luaenv: lua version from luaenv (https://github.com/cehoffman/luaenv) ]########### - # Lua color. - typeset -g POWERLEVEL9K_LUAENV_FOREGROUND=32 - # Hide lua version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_LUAENV_SOURCES=(shell local global) - # If set to false, hide lua version if it's the same as global: - # $(luaenv version-name) == $(luaenv global). - typeset -g POWERLEVEL9K_LUAENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide lua version if it's equal to "system". - typeset -g POWERLEVEL9K_LUAENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_LUAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###############[ jenv: java version from jenv (https://github.com/jenv/jenv) ]################ - # Java color. - typeset -g POWERLEVEL9K_JENV_FOREGROUND=32 - # Hide java version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_JENV_SOURCES=(shell local global) - # If set to false, hide java version if it's the same as global: - # $(jenv version-name) == $(jenv global). - typeset -g POWERLEVEL9K_JENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide java version if it's equal to "system". - typeset -g POWERLEVEL9K_JENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_JENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ plenv: perl version from plenv (https://github.com/tokuhirom/plenv) ]############ - # Perl color. - typeset -g POWERLEVEL9K_PLENV_FOREGROUND=67 - # Hide perl version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PLENV_SOURCES=(shell local global) - # If set to false, hide perl version if it's the same as global: - # $(plenv version-name) == $(plenv global). - typeset -g POWERLEVEL9K_PLENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide perl version if it's equal to "system". - typeset -g POWERLEVEL9K_PLENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ############[ phpenv: php version from phpenv (https://github.com/phpenv/phpenv) ]############ - # PHP color. - typeset -g POWERLEVEL9K_PHPENV_FOREGROUND=99 - # Hide php version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_PHPENV_SOURCES=(shell local global) - # If set to false, hide php version if it's the same as global: - # $(phpenv version-name) == $(phpenv global). - typeset -g POWERLEVEL9K_PHPENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide php version if it's equal to "system". - typeset -g POWERLEVEL9K_PHPENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_PHPENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #######[ scalaenv: scala version from scalaenv (https://github.com/scalaenv/scalaenv) ]####### - # Scala color. - typeset -g POWERLEVEL9K_SCALAENV_FOREGROUND=160 - # Hide scala version if it doesn't come from one of these sources. - typeset -g POWERLEVEL9K_SCALAENV_SOURCES=(shell local global) - # If set to false, hide scala version if it's the same as global: - # $(scalaenv version-name) == $(scalaenv global). - typeset -g POWERLEVEL9K_SCALAENV_PROMPT_ALWAYS_SHOW=false - # If set to false, hide scala version if it's equal to "system". - typeset -g POWERLEVEL9K_SCALAENV_SHOW_SYSTEM=true - # Custom icon. - # typeset -g POWERLEVEL9K_SCALAENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ haskell_stack: haskell version from stack (https://haskellstack.org/) ]########### - # Haskell color. - typeset -g POWERLEVEL9K_HASKELL_STACK_FOREGROUND=172 - # Hide haskell version if it doesn't come from one of these sources. - # - # shell: version is set by STACK_YAML - # local: version is set by stack.yaml up the directory tree - # global: version is set by the implicit global project (~/.stack/global-project/stack.yaml) - typeset -g POWERLEVEL9K_HASKELL_STACK_SOURCES=(shell local) - # If set to false, hide haskell version if it's the same as in the implicit global project. - typeset -g POWERLEVEL9K_HASKELL_STACK_ALWAYS_SHOW=true - # Custom icon. - # typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# - # Show kubecontext only when the the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show kubecontext. - typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern' - - # Kubernetes context classes for the purpose of using different colors, icons and expansions with - # different contexts. - # - # POWERLEVEL9K_KUBECONTEXT_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current kubernetes context gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_KUBECONTEXT_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_KUBECONTEXT_CLASSES defines the context class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' DEFAULT) - # - # If your current kubernetes context is "deathray-testing/default", its class is TEST - # because "deathray-testing/default" doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_FOREGROUND=28 - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_KUBECONTEXT_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_KUBECONTEXT_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' DEFAULT) - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=134 - # typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Use POWERLEVEL9K_KUBECONTEXT_CONTENT_EXPANSION to specify the content displayed by kubecontext - # segment. Parameter expansions are very flexible and fast, too. See reference: - # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion. - # - # Within the expansion the following parameters are always available: - # - # - P9K_CONTENT The content that would've been displayed if there was no content - # expansion defined. - # - P9K_KUBECONTEXT_NAME The current context's name. Corresponds to column NAME in the - # output of `kubectl config get-contexts`. - # - P9K_KUBECONTEXT_CLUSTER The current context's cluster. Corresponds to column CLUSTER in the - # output of `kubectl config get-contexts`. - # - P9K_KUBECONTEXT_NAMESPACE The current context's namespace. Corresponds to column NAMESPACE - # in the output of `kubectl config get-contexts`. If there is no - # namespace, the parameter is set to "default". - # - P9K_KUBECONTEXT_USER The current context's user. Corresponds to column AUTHINFO in the - # output of `kubectl config get-contexts`. - # - # If the context points to Google Kubernetes Engine (GKE) or Elastic Kubernetes Service (EKS), - # the following extra parameters are available: - # - # - P9K_KUBECONTEXT_CLOUD_NAME Either "gke" or "eks". - # - P9K_KUBECONTEXT_CLOUD_ACCOUNT Account/project ID. - # - P9K_KUBECONTEXT_CLOUD_ZONE Availability zone. - # - P9K_KUBECONTEXT_CLOUD_CLUSTER Cluster. - # - # P9K_KUBECONTEXT_CLOUD_* parameters are derived from P9K_KUBECONTEXT_CLUSTER. For example, - # if P9K_KUBECONTEXT_CLUSTER is "gke_my-account_us-east1-a_my-cluster-01": - # - # - P9K_KUBECONTEXT_CLOUD_NAME=gke - # - P9K_KUBECONTEXT_CLOUD_ACCOUNT=my-account - # - P9K_KUBECONTEXT_CLOUD_ZONE=us-east1-a - # - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01 - # - # If P9K_KUBECONTEXT_CLUSTER is "arn:aws:eks:us-east-1:123456789012:cluster/my-cluster-01": - # - # - P9K_KUBECONTEXT_CLOUD_NAME=eks - # - P9K_KUBECONTEXT_CLOUD_ACCOUNT=123456789012 - # - P9K_KUBECONTEXT_CLOUD_ZONE=us-east-1 - # - P9K_KUBECONTEXT_CLOUD_CLUSTER=my-cluster-01 - typeset -g POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION= - # Show P9K_KUBECONTEXT_CLOUD_CLUSTER if it's not empty and fall back to P9K_KUBECONTEXT_NAME. - POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}' - # Append the current context's namespace if it's not "default". - POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION+='${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}' - - # Custom prefix. - # typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat ' - - ################[ terraform: terraform workspace (https://www.terraform.io) ]################# - # Don't show terraform workspace if it's literally "default". - typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT=false - # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current terraform workspace gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' OTHER) - # - # If your current terraform workspace is "project_test", its class is TEST because "project_test" - # doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_FOREGROUND=28 - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' OTHER) - typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=38 - # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #############[ terraform_version: terraform version (https://www.terraform.io) ]############## - # Terraform version color. - typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=38 - # Custom icon. - # typeset -g POWERLEVEL9K_TERRAFORM_VERSION_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]# - # Show aws only when the the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show aws. - typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|terraform|pulumi|terragrunt' - - # POWERLEVEL9K_AWS_CLASSES is an array with even number of elements. The first element - # in each pair defines a pattern against which the current AWS profile gets matched. - # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) - # that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters, - # you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_AWS_CLASSES defines the profile class. Patterns are tried in order. The - # first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_AWS_CLASSES=( - # '*prod*' PROD - # '*test*' TEST - # '*' DEFAULT) - # - # If your current AWS profile is "company_test", its class is TEST - # because "company_test" doesn't match the pattern '*prod*' but does match '*test*'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_AWS_TEST_FOREGROUND=28 - # typeset -g POWERLEVEL9K_AWS_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_AWS_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <' - typeset -g POWERLEVEL9K_AWS_CLASSES=( - # '*prod*' PROD # These values are examples that are unlikely - # '*test*' TEST # to match your needs. Customize them as needed. - '*' DEFAULT) - typeset -g POWERLEVEL9K_AWS_DEFAULT_FOREGROUND=208 - # typeset -g POWERLEVEL9K_AWS_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # AWS segment format. The following parameters are available within the expansion. - # - # - P9K_AWS_PROFILE The name of the current AWS profile. - # - P9K_AWS_REGION The region associated with the current AWS profile. - typeset -g POWERLEVEL9K_AWS_CONTENT_EXPANSION='${P9K_AWS_PROFILE//\%/%%}${P9K_AWS_REGION:+ ${P9K_AWS_REGION//\%/%%}}' - - #[ aws_eb_env: aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/) ]# - # AWS Elastic Beanstalk environment color. - typeset -g POWERLEVEL9K_AWS_EB_ENV_FOREGROUND=70 - # Custom icon. - # typeset -g POWERLEVEL9K_AWS_EB_ENV_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ azure: azure account name (https://docs.microsoft.com/en-us/cli/azure) ]########## - # Show azure only when the the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show azure. - typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi|terragrunt' - # Azure account name color. - typeset -g POWERLEVEL9K_AZURE_FOREGROUND=32 - # Custom icon. - # typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ##########[ gcloud: google cloud account and project (https://cloud.google.com/) ]########### - # Show gcloud only when the the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show gcloud. - typeset -g POWERLEVEL9K_GCLOUD_SHOW_ON_COMMAND='gcloud|gcs' - # Google cloud color. - typeset -g POWERLEVEL9K_GCLOUD_FOREGROUND=32 - - # Google cloud format. Change the value of POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION and/or - # POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION if the default is too verbose or not informative - # enough. You can use the following parameters in the expansions. Each of them corresponds to the - # output of `gcloud` tool. - # - # Parameter | Source - # -------------------------|-------------------------------------------------------------------- - # P9K_GCLOUD_CONFIGURATION | gcloud config configurations list --format='value(name)' - # P9K_GCLOUD_ACCOUNT | gcloud config get-value account - # P9K_GCLOUD_PROJECT_ID | gcloud config get-value project - # P9K_GCLOUD_PROJECT_NAME | gcloud projects describe $P9K_GCLOUD_PROJECT_ID --format='value(name)' - # - # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced with '%%'. - # - # Obtaining project name requires sending a request to Google servers. This can take a long time - # and even fail. When project name is unknown, P9K_GCLOUD_PROJECT_NAME is not set and gcloud - # prompt segment is in state PARTIAL. When project name gets known, P9K_GCLOUD_PROJECT_NAME gets - # set and gcloud prompt segment transitions to state COMPLETE. - # - # You can customize the format, icon and colors of gcloud segment separately for states PARTIAL - # and COMPLETE. You can also hide gcloud in state PARTIAL by setting - # POWERLEVEL9K_GCLOUD_PARTIAL_VISUAL_IDENTIFIER_EXPANSION and - # POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION to empty. - typeset -g POWERLEVEL9K_GCLOUD_PARTIAL_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_ID//\%/%%}' - typeset -g POWERLEVEL9K_GCLOUD_COMPLETE_CONTENT_EXPANSION='${P9K_GCLOUD_PROJECT_NAME//\%/%%}' - - # Send a request to Google (by means of `gcloud projects describe ...`) to obtain project name - # this often. Negative value disables periodic polling. In this mode project name is retrieved - # only when the current configuration, account or project id changes. - typeset -g POWERLEVEL9K_GCLOUD_REFRESH_PROJECT_NAME_SECONDS=60 - - # Custom icon. - # typeset -g POWERLEVEL9K_GCLOUD_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #[ google_app_cred: google application credentials (https://cloud.google.com/docs/authentication/production) ]# - # Show google_app_cred only when the the command you are typing invokes one of these tools. - # Tip: Remove the next line to always show google_app_cred. - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_SHOW_ON_COMMAND='terraform|pulumi|terragrunt' - - # Google application credentials classes for the purpose of using different colors, icons and - # expansions with different credentials. - # - # POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES is an array with even number of elements. The first - # element in each pair defines a pattern against which the current kubernetes context gets - # matched. More specifically, it's P9K_CONTENT prior to the application of context expansion - # (see below) that gets matched. If you unset all POWERLEVEL9K_GOOGLE_APP_CRED_*CONTENT_EXPANSION - # parameters, you'll see this value in your prompt. The second element of each pair in - # POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES defines the context class. Patterns are tried in order. - # The first match wins. - # - # For example, given these settings: - # - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( - # '*:*prod*:*' PROD - # '*:*test*:*' TEST - # '*' DEFAULT) - # - # If your current Google application credentials is "service_account deathray-testing x@y.com", - # its class is TEST because it doesn't match the pattern '* *prod* *' but does match '* *test* *'. - # - # You can define different colors, icons and content expansions for different classes: - # - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_FOREGROUND=28 - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐' - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_TEST_CONTENT_EXPANSION='$P9K_GOOGLE_APP_CRED_PROJECT_ID' - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES=( - # '*:*prod*:*' PROD # These values are examples that are unlikely - # '*:*test*:*' TEST # to match your needs. Customize them as needed. - '*' DEFAULT) - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_FOREGROUND=32 - # typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Use POWERLEVEL9K_GOOGLE_APP_CRED_CONTENT_EXPANSION to specify the content displayed by - # google_app_cred segment. Parameter expansions are very flexible and fast, too. See reference: - # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion. - # - # You can use the following parameters in the expansion. Each of them corresponds to one of the - # fields in the JSON file pointed to by GOOGLE_APPLICATION_CREDENTIALS. - # - # Parameter | JSON key file field - # ---------------------------------+--------------- - # P9K_GOOGLE_APP_CRED_TYPE | type - # P9K_GOOGLE_APP_CRED_PROJECT_ID | project_id - # P9K_GOOGLE_APP_CRED_CLIENT_EMAIL | client_email - # - # Note: ${VARIABLE//\%/%%} expands to ${VARIABLE} with all occurrences of '%' replaced by '%%'. - typeset -g POWERLEVEL9K_GOOGLE_APP_CRED_DEFAULT_CONTENT_EXPANSION='${P9K_GOOGLE_APP_CRED_PROJECT_ID//\%/%%}' - - ##############[ toolbox: toolbox name (https://github.com/containers/toolbox) ]############### - # Toolbox color. - typeset -g POWERLEVEL9K_TOOLBOX_FOREGROUND=178 - # Don't display the name of the toolbox if it matches fedora-toolbox-*. - typeset -g POWERLEVEL9K_TOOLBOX_CONTENT_EXPANSION='${P9K_TOOLBOX_NAME:#fedora-toolbox-*}' - # Custom icon. - # typeset -g POWERLEVEL9K_TOOLBOX_VISUAL_IDENTIFIER_EXPANSION='⭐' - # Custom prefix. - # typeset -g POWERLEVEL9K_TOOLBOX_PREFIX='%fin ' - - ###############################[ public_ip: public IP address ]############################### - # Public IP color. - typeset -g POWERLEVEL9K_PUBLIC_IP_FOREGROUND=94 - # Custom icon. - # typeset -g POWERLEVEL9K_PUBLIC_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ########################[ vpn_ip: virtual private network indicator ]######################### - # VPN IP color. - typeset -g POWERLEVEL9K_VPN_IP_FOREGROUND=81 - # When on VPN, show just an icon without the IP address. - # Tip: To display the private IP address when on VPN, remove the next line. - typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION= - # Regular expression for the VPN network interface. Run `ifconfig` or `ip -4 a show` while on VPN - # to see the name of the interface. - typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(gpd|wg|(.*tun)|tailscale)[0-9]*' - # If set to true, show one segment per matching network interface. If set to false, show only - # one segment corresponding to the first matching network interface. - # Tip: If you set it to true, you'll probably want to unset POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION. - typeset -g POWERLEVEL9K_VPN_IP_SHOW_ALL=false - # Custom icon. - # typeset -g POWERLEVEL9K_VPN_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ###########[ ip: ip address and bandwidth usage for a specified network interface ]########### - # IP color. - typeset -g POWERLEVEL9K_IP_FOREGROUND=38 - # The following parameters are accessible within the expansion: - # - # Parameter | Meaning - # ----------------------+------------------------------------------- - # P9K_IP_IP | IP address - # P9K_IP_INTERFACE | network interface - # P9K_IP_RX_BYTES | total number of bytes received - # P9K_IP_TX_BYTES | total number of bytes sent - # P9K_IP_RX_BYTES_DELTA | number of bytes received since last prompt - # P9K_IP_TX_BYTES_DELTA | number of bytes sent since last prompt - # P9K_IP_RX_RATE | receive rate (since last prompt) - # P9K_IP_TX_RATE | send rate (since last prompt) - typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='$P9K_IP_IP${P9K_IP_RX_RATE:+ %70F⇣$P9K_IP_RX_RATE}${P9K_IP_TX_RATE:+ %215F⇡$P9K_IP_TX_RATE}' - # Show information for the first network interface whose name matches this regular expression. - # Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces. - typeset -g POWERLEVEL9K_IP_INTERFACE='[ew].*' - # Custom icon. - # typeset -g POWERLEVEL9K_IP_VISUAL_IDENTIFIER_EXPANSION='⭐' - - #########################[ proxy: system-wide http/https/ftp proxy ]########################## - # Proxy color. - typeset -g POWERLEVEL9K_PROXY_FOREGROUND=68 - # Custom icon. - # typeset -g POWERLEVEL9K_PROXY_VISUAL_IDENTIFIER_EXPANSION='⭐' - - ################################[ battery: internal battery ]################################# - # Show battery in red when it's below this level and not connected to power supply. - typeset -g POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20 - typeset -g POWERLEVEL9K_BATTERY_LOW_FOREGROUND=160 - # Show battery in green when it's charging or fully charged. - typeset -g POWERLEVEL9K_BATTERY_{CHARGING,CHARGED}_FOREGROUND=70 - # Show battery in yellow when it's discharging. - typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=178 - # Battery pictograms going from low to high level of charge. - typeset -g POWERLEVEL9K_BATTERY_STAGES='\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578' - # Don't show the remaining time to charge/discharge. - typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false - - #####################################[ wifi: wifi speed ]##################################### - # WiFi color. - typeset -g POWERLEVEL9K_WIFI_FOREGROUND=68 - # Custom icon. - # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Use different colors and icons depending on signal strength ($P9K_WIFI_BARS). - # - # # Wifi colors and icons for different signal strength levels (low to high). - # typeset -g my_wifi_fg=(68 68 68 68 68) # <-- change these values - # typeset -g my_wifi_icon=('WiFi' 'WiFi' 'WiFi' 'WiFi' 'WiFi') # <-- change these values - # - # typeset -g POWERLEVEL9K_WIFI_CONTENT_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}$P9K_WIFI_LAST_TX_RATE Mbps' - # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}${my_wifi_icon[P9K_WIFI_BARS+1]}' - # - # The following parameters are accessible within the expansions: - # - # Parameter | Meaning - # ----------------------+--------------- - # P9K_WIFI_SSID | service set identifier, a.k.a. network name - # P9K_WIFI_LINK_AUTH | authentication protocol such as "wpa2-psk" or "none"; empty if unknown - # P9K_WIFI_LAST_TX_RATE | wireless transmit rate in megabits per second - # P9K_WIFI_RSSI | signal strength in dBm, from -120 to 0 - # P9K_WIFI_NOISE | noise in dBm, from -120 to 0 - # P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE) - - ####################################[ time: current time ]#################################### - # Current time color. - typeset -g POWERLEVEL9K_TIME_FOREGROUND=66 - # Format for the current time: 09:51:02. See `man 3 strftime`. - typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}' - # If set to true, time will update when you hit enter. This way prompts for the past - # commands will contain the start times of their commands as opposed to the default - # behavior where they contain the end times of their preceding commands. - typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false - # Custom icon. - # typeset -g POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION='⭐' - # Custom prefix. - # typeset -g POWERLEVEL9K_TIME_PREFIX='%fat ' - - # Example of a user-defined prompt segment. Function prompt_example will be called on every - # prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or - # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and orange text greeting the user. - # - # Type `p10k help segment` for documentation and a more sophisticated example. - function prompt_example() { - p10k segment -f 208 -i '⭐' -t 'hello, %n' - } - - # User-defined prompt segments may optionally provide an instant_prompt_* function. Its job - # is to generate the prompt segment for display in instant prompt. See - # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. - # - # Powerlevel10k will call instant_prompt_* at the same time as the regular prompt_* function - # and will record all `p10k segment` calls it makes. When displaying instant prompt, Powerlevel10k - # will replay these calls without actually calling instant_prompt_*. It is imperative that - # instant_prompt_* always makes the same `p10k segment` calls regardless of environment. If this - # rule is not observed, the content of instant prompt will be incorrect. - # - # Usually, you should either not define instant_prompt_* or simply call prompt_* from it. If - # instant_prompt_* is not defined for a segment, the segment won't be shown in instant prompt. - function instant_prompt_example() { - # Since prompt_example always makes the same `p10k segment` calls, we can call it from - # instant_prompt_example. This will give us the same `example` prompt segment in the instant - # and regular prompts. - prompt_example - } - - # User-defined prompt segments can be customized the same way as built-in segments. - # typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208 - # typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐' - - # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt - # when accepting a command line. Supported values: - # - # - off: Don't change prompt when accepting a command line. - # - always: Trim down prompt when accepting a command line. - # - same-dir: Trim down prompt when accepting a command line unless this is the first command - # typed after changing current working directory. - typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always - - # Instant prompt mode. - # - # - off: Disable instant prompt. Choose this if you've tried instant prompt and found - # it incompatible with your zsh configuration files. - # - quiet: Enable instant prompt and don't print warnings when detecting console output - # during zsh initialization. Choose this if you've read and understood - # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. - # - verbose: Enable instant prompt and print a warning when detecting console output during - # zsh initialization. Choose this if you've never tried instant prompt, haven't - # seen the warning, or if you are unsure what this all means. - typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet - - # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. - # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload - # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you - # really need it. - typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true - - # If p10k is already loaded, reload configuration. - # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true. - (( ! $+functions[p10k] )) || p10k reload -} - -# Tell `p10k configure` which file it should overwrite. -typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a} - -(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} -'builtin' 'unset' 'p10k_config_opts' From f7840db8ec1871cdfdc6a60cc125ecc3a137ebe4 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 10:51:16 +0000 Subject: [PATCH 05/38] +lint --- lib/zsh/additional.zsh | 12 +- lib/zsh/autoload.zsh | 5 +- lib/zsh/install.zsh | 282 ++++++++++++++++++++--------------------- lib/zsh/rpm2cpio.zsh | 28 ++-- lib/zsh/side.zsh | 10 +- 5 files changed, 165 insertions(+), 172 deletions(-) diff --git a/lib/zsh/additional.zsh b/lib/zsh/additional.zsh index 69fee9b1..69a05fb1 100755 --- a/lib/zsh/additional.zsh +++ b/lib/zsh/additional.zsh @@ -41,14 +41,11 @@ .zi-service() { emulate -LR zsh setopt extendedglob warncreateglobal typesetsilent noshortloops - local ___tpe="$1" ___mode="$2" ___id="$3" ___fle="${ZI[SERVICES_DIR]}/${ICE[service]}.lock" ___fd ___cmd ___tmp ___lckd ___strd=0 { builtin print -n >! "$___fle"; } 2>/dev/null 1>&2 [[ ! -e ${___fle:r}.fifo ]] && command mkfifo "${___fle:r}.fifo" 2>/dev/null 1>&2 [[ ! -e ${___fle:r}.fifo2 ]] && command mkfifo "${___fle:r}.fifo2" 2>/dev/null 1>&2 - typeset -g ZSRV_WORK_DIR="${ZI[SERVICES_DIR]}" ZSRV_ID="${ICE[service]}" # should be also set by other p-m - while (( 1 )); do ( while (( 1 )); do @@ -63,7 +60,6 @@ else return 0 fi - [[ $___cmd = (#i)NEXT ]] && { kill -TERM "$ZSRV_PID"; builtin read -t 2 ___tmp <>"${___fle:r}.fifo2"; kill -HUP "$ZSRV_PID"; exec {___fd}>&-; ___lckd=0; ___strd=0; builtin read -t 10 ___tmp <>"${___fle:r}.fifo2"; } [[ $___cmd = (#i)STOP ]] && { kill -TERM "$ZSRV_PID"; builtin read -t 2 ___tmp <>"${___fle:r}.fifo2"; kill -HUP "$ZSRV_PID"; ___strd=0; builtin print >! "${___fle:r}.stop"; } [[ $___cmd = (#i)QUIT ]] && { kill -HUP ${sysparams[pid]}; return 1; } @@ -108,12 +104,12 @@ function $f { return 1 fi - ZI[DTRACE]=1 +ZI[DTRACE]=1 - .zi-diff _dtrace/_dtrace begin +.zi-diff _dtrace/_dtrace begin - # Full shadeing on - .zi-tmp-subst-on dtrace +# Full shadeing on +.zi-tmp-subst-on dtrace } # ]]] # FUNCTION: .zi-debug-stop [[[ # Stops Dtrace, i.e. session tracking for changes in Zsh state. diff --git a/lib/zsh/autoload.zsh b/lib/zsh/autoload.zsh index 4b7b66c2..2d81ae5c 100755 --- a/lib/zsh/autoload.zsh +++ b/lib/zsh/autoload.zsh @@ -2637,7 +2637,7 @@ builtin print -Pr \"\$ZI[col-obj]Done (with the exit code: \$_retval).%f%b\"" # Copyright (c) $year $user_name # According to the Zsh Plugin Standard: -# http://z-shell.github.io/ZSH-TOP-100/Zsh-Plugin-Standard.html +# https://github.com/z-shell/zi/wiki/Zsh-Plugin-Standard 0=\${\${ZERO:-\${0:#\$ZSH_ARGZERO}}:-\${(%):-%N}} 0=\${\${(M)0:#/*}:-\$PWD/\$0} @@ -2747,8 +2747,7 @@ EOF local -A ICE2 local local_dir filename is_snippet the_id="$1${${1:#(%|/)*}:+${2:+/}}$2" - .zi-compute-ice "$the_id" "pack" \ - ICE2 local_dir filename is_snippet || return 1 + .zi-compute-ice "$the_id" "pack" ICE2 local_dir filename is_snippet || return 1 ICE2[teleid]="${ICE2[teleid]:-${ICE2[id-as]}}" if (( is_snippet )); then diff --git a/lib/zsh/install.zsh b/lib/zsh/install.zsh index 27bf23d0..de067261 100755 --- a/lib/zsh/install.zsh +++ b/lib/zsh/install.zsh @@ -1908,198 +1908,196 @@ zimv() { # ]]] # FUNCTION: ∞zi-reset-opt-hook [[[ ∞zi-reset-hook() { - # File - if [[ "$1" = plugin ]] { - local type="$1" user="$2" plugin="$3" id_as="$4" dir="${5#%}" hook="$6" +# File +if [[ "$1" = plugin ]] { + local type="$1" user="$2" plugin="$3" id_as="$4" dir="${5#%}" hook="$6" +} else { + local type="$1" url="$2" id_as="$3" dir="${4#%}" hook="$5" +} +if (( ( OPTS[opt_-r,--reset] && ZI[-r/--reset-opt-hook-has-been-run] == 0 ) || ( ${+ICE[reset]} && ZI[-r/--reset-opt-hook-has-been-run] == 1 ) +)) { + if (( ZI[-r/--reset-opt-hook-has-been-run] )) { + local msg_bit="{meta}reset{msg2} ice given{pre}" option= } else { - local type="$1" url="$2" id_as="$3" dir="${4#%}" hook="$5" + local msg_bit="{meta2}-r/--reset{msg2} given to \`{meta}update{pre}'" option=1 } - if (( ( OPTS[opt_-r,--reset] && ZI[-r/--reset-opt-hook-has-been-run] == 0 ) || ( ${+ICE[reset]} && ZI[-r/--reset-opt-hook-has-been-run] == 1 ) - )) { - if (( ZI[-r/--reset-opt-hook-has-been-run] )) { - local msg_bit="{meta}reset{msg2} ice given{pre}" option= + if [[ $type == snippet ]] { + if (( $+ICE[svn] )) { + if [[ $skip_pull -eq 0 && -d $filename/.svn ]] { + (( !OPTS[opt_-q,--quiet] )) && +zi-message "{pre}reset ($msg_bit): {msg2}Resetting the repository ($msg_bit) with command: {rst}svn revert --recursive {…}/{file}$filename/.{rst} {…}" + command svn revert --recursive $filename/. + } } else { - local msg_bit="{meta2}-r/--reset{msg2} given to \`{meta}update{pre}'" option=1 - } - if [[ $type == snippet ]] { - if (( $+ICE[svn] )) { - if [[ $skip_pull -eq 0 && -d $filename/.svn ]] { - (( !OPTS[opt_-q,--quiet] )) && +zi-message "{pre}reset ($msg_bit): {msg2}Resetting the repository ($msg_bit) with command: {rst}svn revert --recursive {…}/{file}$filename/.{rst} {…}" - command svn revert --recursive $filename/. - } - } else { - if (( ZI[annex-multi-flag:pull-active] >= 2 )) { - if (( !OPTS[opt_-q,--quiet] )) { - if [[ -f $local_dir/$dirname/$filename ]] { - if [[ -n $option || -z $ICE[reset] ]] { - +zi-message "{pre}reset ($msg_bit):{msg2} Removing the snippet-file: {file}$filename{msg2} {…}{rst}" - } else { - +zi-message "{pre}reset ($msg_bit):{msg2} Removing the snippet-file: {file}$filename{msg2}," \ - "with the supplied code: {data2}$ICE[reset]{msg2} {…}{rst}" - } - if (( option )) { - command rm -f "$local_dir/$dirname/$filename" - } else { - eval "${ICE[reset]:-rm -f \"$local_dir/$dirname/$filename\"}" - } + if (( ZI[annex-multi-flag:pull-active] >= 2 )) { + if (( !OPTS[opt_-q,--quiet] )) { + if [[ -f $local_dir/$dirname/$filename ]] { + if [[ -n $option || -z $ICE[reset] ]] { + +zi-message "{pre}reset ($msg_bit):{msg2} Removing the snippet-file: {file}$filename{msg2} {…}{rst}" } else { - +zi-message "{pre}reset ($msg_bit):{msg2} The file {file}$filename{msg2} is already deleted {…}{rst}" - if [[ -n $ICE[reset] && ! -n $option ]] { - +zi-message "{pre}reset ($msg_bit):{msg2} (skipped running the provided reset-code:" \ - "{data2}$ICE[reset]{msg2}){rst}" - } + +zi-message "{pre}reset ($msg_bit):{msg2} Removing the snippet-file: {file}$filename{msg2}," \ + "with the supplied code: {data2}$ICE[reset]{msg2} {…}{rst}" + } + if (( option )) { + command rm -f "$local_dir/$dirname/$filename" + } else { + eval "${ICE[reset]:-rm -f \"$local_dir/$dirname/$filename\"}" + } + } else { + +zi-message "{pre}reset ($msg_bit):{msg2} The file {file}$filename{msg2} is already deleted {…}{rst}" + if [[ -n $ICE[reset] && ! -n $option ]] { + +zi-message "{pre}reset ($msg_bit):{msg2} (skipped running the provided reset-code:" \ + "{data2}$ICE[reset]{msg2}){rst}" } } - } else { - [[ -f $local_dir/$dirname/$filename ]] && \ - +zi-message "{pre}reset ($msg_bit): {msg2}Skipping the removal of {file}$filename{msg2}" \ - "as there is no new copy scheduled for download.{rst}" || \ - +zi-message "{pre}reset ($msg_bit): {msg2}The file {file}$filename{msg2} is already deleted" \ - "and {ehi}no new download is being scheduled.{rst}" } + } else { + [[ -f $local_dir/$dirname/$filename ]] && \ + +zi-message "{pre}reset ($msg_bit): {msg2}Skipping the removal of {file}$filename{msg2}" \ + "as there is no new copy scheduled for download.{rst}" || \ + +zi-message "{pre}reset ($msg_bit): {msg2}The file {file}$filename{msg2} is already deleted" \ + "and {ehi}no new download is being scheduled.{rst}" } - } elif [[ $type == plugin ]] { - if (( is_release && !skip_pull )) { - if (( option )) { - (( !OPTS[opt_-q,--quiet] )) && +zi-message "{pre}reset ($msg_bit): {msg2}running: {rst}rm -rf ${${ZI[PLUGINS_DIR]:#[/[:space:]]##}:-${TMPDIR:-/tmp}/xyzabc312}/${${(M)${local_dir##${ZI[PLUGINS_DIR]}[/[:space:]]#}:#[^/]*}:-${TMPDIR:-/tmp}/xyzabc312-zi-protection-triggered}/*" - builtin eval command rm -rf ${${ZI[PLUGINS_DIR]:#[/[:space:]]##}:-${TMPDIR:-/tmp}/xyzabc312}/"${${(M)${local_dir##${ZI[PLUGINS_DIR]}[/[:space:]]#}:#[^/]*}:-${TMPDIR:-/tmp}/xyzabc312-zi-protection-triggered}"/*(ND) - } else { - (( !OPTS[opt_-q,--quiet] )) && +zi-message "{pre}reset ($msg_bit): {msg2}running: {rst}${ICE[reset]:-rm -rf ${${ZI[PLUGINS_DIR]:#[/[:space:]]##}:-${TMPDIR:-/tmp}/xyzabc312}/${${(M)${local_dir##${ZI[PLUGINS_DIR]}[/[:space:]]#}:#[^/]*}:-${TMPDIR:-/tmp}/xyzabc312-zi-protection-triggered}/*}" - builtin eval ${ICE[reset]:-command rm -rf ${${ZI[PLUGINS_DIR]:#[/[:space:]]##}:-${TMPDIR:-/tmp}/xyzabc312}/"${${(M)${local_dir##${ZI[PLUGINS_DIR]}[/[:space:]]#}:#[^/]*}:-${TMPDIR:-/tmp}/xyzabc312-zi-protection-triggered}"/*(ND)} - } - } elif (( !skip_pull )) { - if (( option )) { - +zi-message "{pre}reset ($msg_bit): {msg2}Resetting the repository with command:{rst} git reset --hard HEAD {…}" - command git reset --hard HEAD - } else { - +zi-message "{pre}reset ($msg_bit): {msg2}Resetting the repository with command:{rst} ${ICE[reset]:-git reset --hard HEAD} {…}" - builtin eval "${ICE[reset]:-git reset --hard HEAD}" - } + } + } elif [[ $type == plugin ]] { + if (( is_release && !skip_pull )) { + if (( option )) { + (( !OPTS[opt_-q,--quiet] )) && +zi-message "{pre}reset ($msg_bit): {msg2}running: {rst}rm -rf ${${ZI[PLUGINS_DIR]:#[/[:space:]]##}:-${TMPDIR:-/tmp}/xyzabc312}/${${(M)${local_dir##${ZI[PLUGINS_DIR]}[/[:space:]]#}:#[^/]*}:-${TMPDIR:-/tmp}/xyzabc312-zi-protection-triggered}/*" + builtin eval command rm -rf ${${ZI[PLUGINS_DIR]:#[/[:space:]]##}:-${TMPDIR:-/tmp}/xyzabc312}/"${${(M)${local_dir##${ZI[PLUGINS_DIR]}[/[:space:]]#}:#[^/]*}:-${TMPDIR:-/tmp}/xyzabc312-zi-protection-triggered}"/*(ND) + } else { + (( !OPTS[opt_-q,--quiet] )) && +zi-message "{pre}reset ($msg_bit): {msg2}running: {rst}${ICE[reset]:-rm -rf ${${ZI[PLUGINS_DIR]:#[/[:space:]]##}:-${TMPDIR:-/tmp}/xyzabc312}/${${(M)${local_dir##${ZI[PLUGINS_DIR]}[/[:space:]]#}:#[^/]*}:-${TMPDIR:-/tmp}/xyzabc312-zi-protection-triggered}/*}" + builtin eval ${ICE[reset]:-command rm -rf ${${ZI[PLUGINS_DIR]:#[/[:space:]]##}:-${TMPDIR:-/tmp}/xyzabc312}/"${${(M)${local_dir##${ZI[PLUGINS_DIR]}[/[:space:]]#}:#[^/]*}:-${TMPDIR:-/tmp}/xyzabc312-zi-protection-triggered}"/*(ND)} + } + } elif (( !skip_pull )) { + if (( option )) { + +zi-message "{pre}reset ($msg_bit): {msg2}Resetting the repository with command:{rst} git reset --hard HEAD {…}" + command git reset --hard HEAD + } else { + +zi-message "{pre}reset ($msg_bit): {msg2}Resetting the repository with command:{rst} ${ICE[reset]:-git reset --hard HEAD} {…}" + builtin eval "${ICE[reset]:-git reset --hard HEAD}" } } } +} - if (( OPTS[opt_-r,--reset] )) { - if (( ZI[-r/--reset-opt-hook-has-been-run] == 1 )) { - ZI[-r/--reset-opt-hook-has-been-run]=0 - } else { - ZI[-r/--reset-opt-hook-has-been-run]=1 - } +if (( OPTS[opt_-r,--reset] )) { + if (( ZI[-r/--reset-opt-hook-has-been-run] == 1 )) { + ZI[-r/--reset-opt-hook-has-been-run]=0 } else { - # If there's no -r/--reset, pretend that it already has been served. ZI[-r/--reset-opt-hook-has-been-run]=1 } +} else { + # If there's no -r/--reset, pretend that it already has been served. + ZI[-r/--reset-opt-hook-has-been-run]=1 +} } # ]]] # FUNCTION: ∞zi-make-ee-hook [[[ ∞zi-make-ee-hook() { - [[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" +[[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" - local make=${ICE[make]} - @zi-substitute make - # Git-plugin make'' at download - [[ $make = "!!"* ]] && .zi-countdown make && command make -C "$dir" ${(@s; ;)${make#\!\!}} +local make=${ICE[make]} +@zi-substitute make +# Git-plugin make'' at download +[[ $make = "!!"* ]] && .zi-countdown make && command make -C "$dir" ${(@s; ;)${make#\!\!}} } # ]]] # FUNCTION: ∞zi-make-e-hook [[[ ∞zi-make-e-hook() { - [[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" +[[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" - local make=${ICE[make]} - @zi-substitute make - # Git-plugin make'' at download - [[ $make = ("!"[^\!]*|"!") ]] && .zi-countdown make && command make -C "$dir" ${(@s; ;)${make#\!}} +local make=${ICE[make]} +@zi-substitute make +# Git-plugin make'' at download +[[ $make = ("!"[^\!]*|"!") ]] && .zi-countdown make && command make -C "$dir" ${(@s; ;)${make#\!}} } # ]]] # FUNCTION: ∞zi-make-hook [[[ ∞zi-make-hook() { - [[ "$1" = plugin ]] && \ - local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" - - local make=${ICE[make]} - @zi-substitute make - # Git-plugin make'' at download - (( ${+ICE[make]} )) && [[ $make != "!"* ]] && .zi-countdown make && command make -C "$dir" ${(@s; ;)make} +[[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" +local make=${ICE[make]} +@zi-substitute make +# Git-plugin make'' at download +(( ${+ICE[make]} )) && [[ $make != "!"* ]] && .zi-countdown make && command make -C "$dir" ${(@s; ;)make} } # ]]] # FUNCTION: ∞zi-atclone-hook [[[ ∞zi-atclone-hook() { - [[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" - local atclone=${ICE[atclone]} - @zi-substitute atclone - [[ -n $atclone ]] && .zi-countdown atclone && { local ___oldcd=$PWD; (( ${+ICE[nocd]} == 0 )) && { () { setopt localoptions noautopushd; builtin cd -q "$dir"; } && eval "$atclone"; ((1)); } || eval "$atclone"; () { setopt localoptions noautopushd; builtin cd -q "$___oldcd"; }; } +[[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" +local atclone=${ICE[atclone]} +@zi-substitute atclone +[[ -n $atclone ]] && .zi-countdown atclone && { local ___oldcd=$PWD; (( ${+ICE[nocd]} == 0 )) && { () { setopt localoptions noautopushd; builtin cd -q "$dir"; } && eval "$atclone"; ((1)); } || eval "$atclone"; () { setopt localoptions noautopushd; builtin cd -q "$___oldcd"; }; } } # ]]] # FUNCTION: ∞zi-extract-hook [[[ ∞zi-extract-hook() { - [[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" - local extract=${ICE[extract]} - @zi-substitute extract - (( ${+ICE[extract]} )) && .zi-extract plugin "$extract" "$dir" +[[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" +local extract=${ICE[extract]} +@zi-substitute extract +(( ${+ICE[extract]} )) && .zi-extract plugin "$extract" "$dir" } # ]]] # FUNCTION: ∞zi-mv-hook [[[ ∞zi-mv-hook() { - [[ -z $ICE[mv] ]] && return - [[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" - if [[ $ICE[mv] == *("->"|"→")* ]] { - local from=${ICE[mv]%%[[:space:]]#(->|→)*} to=${ICE[mv]##*(->|→)[[:space:]]#} || \ - } else { - local from=${ICE[mv]%%[[:space:]]##*} to=${ICE[mv]##*[[:space:]]##} - } - @zi-substitute from to - local -a afr - ( () { setopt localoptions noautopushd; builtin cd -q "$dir"; } || return 1 - afr=( ${~from}(DN) ) - if (( ${#afr} )) { - if (( !OPTS[opt_-q,--quiet] )) { - command mv -vf "${afr[1]}" "$to" - command mv -vf "${afr[1]}".zwc "$to".zwc 2>/dev/null - } else { - command mv -f "${afr[1]}" "$to" - command mv -f "${afr[1]}".zwc "$to".zwc 2>/dev/null - } +[[ -z $ICE[mv] ]] && return +[[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" +if [[ $ICE[mv] == *("->"|"→")* ]] { + local from=${ICE[mv]%%[[:space:]]#(->|→)*} to=${ICE[mv]##*(->|→)[[:space:]]#} || \ +} else { + local from=${ICE[mv]%%[[:space:]]##*} to=${ICE[mv]##*[[:space:]]##} +} +@zi-substitute from to +local -a afr +( () { setopt localoptions noautopushd; builtin cd -q "$dir"; } || return 1 + afr=( ${~from}(DN) ) + if (( ${#afr} )) { + if (( !OPTS[opt_-q,--quiet] )) { + command mv -vf "${afr[1]}" "$to" + command mv -vf "${afr[1]}".zwc "$to".zwc 2>/dev/null + } else { + command mv -f "${afr[1]}" "$to" + command mv -f "${afr[1]}".zwc "$to".zwc 2>/dev/null } - ) + } +) } # ]]] # FUNCTION: ∞zi-cp-hook [[[ ∞zi-cp-hook() { - [[ -z $ICE[cp] ]] && return - [[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" +[[ -z $ICE[cp] ]] && return +[[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" - if [[ $ICE[cp] == *("->"|"→")* ]] { - local from=${ICE[cp]%%[[:space:]]#(->|→)*} to=${ICE[cp]##*(->|→)[[:space:]]#} || \ - } else { - local from=${ICE[cp]%%[[:space:]]##*} to=${ICE[cp]##*[[:space:]]##} - } +if [[ $ICE[cp] == *("->"|"→")* ]] { + local from=${ICE[cp]%%[[:space:]]#(->|→)*} to=${ICE[cp]##*(->|→)[[:space:]]#} || \ +} else { + local from=${ICE[cp]%%[[:space:]]##*} to=${ICE[cp]##*[[:space:]]##} +} - @zi-substitute from to +@zi-substitute from to - local -a afr - ( () { setopt localoptions noautopushd; builtin cd -q "$dir"; } || return 1 - afr=( ${~from}(DN) ) - if (( ${#afr} )) { - if (( !OPTS[opt_-q,--quiet] )) { - command cp -vf "${afr[1]}" "$to" - command cp -vf "${afr[1]}".zwc "$to".zwc 2>/dev/null - } else { - command cp -f "${afr[1]}" "$to" - command cp -f "${afr[1]}".zwc "$to".zwc 2>/dev/null - } +local -a afr +( () { setopt localoptions noautopushd; builtin cd -q "$dir"; } || return 1 + afr=( ${~from}(DN) ) + if (( ${#afr} )) { + if (( !OPTS[opt_-q,--quiet] )) { + command cp -vf "${afr[1]}" "$to" + command cp -vf "${afr[1]}".zwc "$to".zwc 2>/dev/null + } else { + command cp -f "${afr[1]}" "$to" + command cp -f "${afr[1]}".zwc "$to".zwc 2>/dev/null } - ) + } +) } # ]]] # FUNCTION: ∞zi-compile-plugin-hook [[[ ∞zi-compile-plugin-hook() { - [[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" +[[ "$1" = plugin ]] && local dir="${5#%}" hook="$6" subtype="$7" || local dir="${4#%}" hook="$5" subtype="$6" if [[ ( $hook = *\!at(clone|pull)* && ${+ICE[nocompile]} -eq 0 ) || ( $hook = at(clone|pull)* && $ICE[nocompile] = '!' ) ]] { - # Compile plugin - if [[ -z $ICE[(i)(\!|)(sh|bash|ksh|csh)] ]] { - () { - emulate -LR zsh - setopt extendedglob warncreateglobal - if [[ $tpe == snippet ]] { - .zi-compile-plugin "%$dir" "" - } else { - .zi-compile-plugin "$id_as" "" - } + # Compile plugin + if [[ -z $ICE[(i)(\!|)(sh|bash|ksh|csh)] ]] { + () { + emulate -LR zsh + setopt extendedglob warncreateglobal + if [[ $tpe == snippet ]] { + .zi-compile-plugin "%$dir" "" + } else { + .zi-compile-plugin "$id_as" "" } } } + } } # ]]] # FUNCTION: ∞zi-atpull-e-hook [[[ ∞zi-atpull-e-hook() { diff --git a/lib/zsh/rpm2cpio.zsh b/lib/zsh/rpm2cpio.zsh index 76f023a7..24a9323c 100755 --- a/lib/zsh/rpm2cpio.zsh +++ b/lib/zsh/rpm2cpio.zsh @@ -4,8 +4,8 @@ emulate -R zsh -o extendedglob local pkg=$1 if [[ -z $pkg || ! -e $pkg ]] { - print -u2 -Pr "%F{160}rpm2cpio.sh%f: no package supplied" - exit 1 + print -u2 -Pr "%F{160}rpm2cpio.sh%f: no package supplied" + exit 1 } local leadsize=96 @@ -29,23 +29,23 @@ local COMPRESSION="$($=UNPACKCMD | file -)" local -a DECOMPRESSCMD if [[ $COMPRESSION == (#i)*gzip* ]] { - DECOMPRESSCMD=( gunzip ) + DECOMPRESSCMD=( gunzip ) } elif [[ $COMPRESSION == (#i)*bzip2* ]] { - DECOMPRESSCMD=( bunzip2 ) + DECOMPRESSCMD=( bunzip2 ) } elif [[ $COMPRESSION == (#i)*xz* ]] { - DECOMPRESSCMD=( unxz ) + DECOMPRESSCMD=( unxz ) } elif [[ $COMPRESSION == (#i)*cpio* ]] { - DECOMPRESSCMD=( cat ) + DECOMPRESSCMD=( cat ) } else { - DECOMPRESSCMD=( $(which unlzma 2>/dev/null) ) - if [[ $DECOMPRESSCMD != /* ]] { - DECOMPRESSCMD=( $(which lzmash 2>/dev/null) ) - if [[ $DECOMPRESSCMD == /* ]] { - DECOMPRESSCMD=( lzmash -d -c ) - } else { - DECOMPRESSCMD=( cat ) - } + DECOMPRESSCMD=( $(which unlzma 2>/dev/null) ) + if [[ $DECOMPRESSCMD != /* ]] { + DECOMPRESSCMD=( $(which lzmash 2>/dev/null) ) + if [[ $DECOMPRESSCMD == /* ]] { + DECOMPRESSCMD=( lzmash -d -c ) + } else { + DECOMPRESSCMD=( cat ) } + } } command "$UNPACKCMD[@]" 2>/dev/null | command "$DECOMPRESSCMD[@]" diff --git a/lib/zsh/side.zsh b/lib/zsh/side.zsh index 59eb6f7f..6014cb84 100755 --- a/lib/zsh/side.zsh +++ b/lib/zsh/side.zsh @@ -259,9 +259,9 @@ for ___key in ${ice_order[@]}; do [[ $___key == (no|)compile ]] && continue (( 0 == ${+ICE[no$___key]} && 0 == ${+___sice[no$___key]} )) && continue - # "If there is such ice currently, and there's no no* ice given, and there's the no* ice in the static ice" – skip, don't unset. - # With conjunction with the previous line this has the proper meaning: uset if at least in one – current or static – ice - # there's the no* ice, but not if it's only in the static ice (unless there's on such ice "anyway"). + # "If there is such ice currently, and there's no no* ice given, and there's the no* ice in the static ice" – skip, don't unset. + # With conjunction with the previous line this has the proper meaning: uset if at least in one – current or static – ice + # there's the no* ice, but not if it's only in the static ice (unless there's on such ice "anyway"). (( 1 == ${+ICE[$___key]} && 0 == ${+ICE[no$___key]} && 1 == ${+___sice[no$___key]} )) && continue if [[ "$___key" = "svn" ]]; then command builtin print -r -- "0" >! "$___zi_path/mode" @@ -297,8 +297,8 @@ # $2 - name of hash that holds values # $3 - additional keys of hash to store, space separated # $4 - additional keys of hash to store, empty-meaningful ices, space separated -# $5 – the URL, if applicable -# $6 – the mode (1 - svn, 0 - single file), if applicable +# $5 - the URL, if applicable +# $6 - the mode (1 - svn, 0 - single file), if applicable .zi-store-ices() { local ___pfx="$1" ___ice_var="$2" ___add_ices="$3" ___add_ices2="$4" url="$5" mode="$6" # Copy from .zi-recall From df604ea34f329fff2daff01f3b192519bb0d0eb6 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 11:14:15 +0000 Subject: [PATCH 06/38] modified: lib/_zi --- lib/_zi | 447 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 236 insertions(+), 211 deletions(-) diff --git a/lib/_zi b/lib/_zi index 23e790b5..3d395b5e 100755 --- a/lib/_zi +++ b/lib/_zi @@ -61,7 +61,9 @@ commands=( add-fpath:'Add plugin folder to $fpath' ) -_arguments -C '1: :->command''*: :->argument' && ret=0 +_arguments -C \ + '1: :->command'\ + '*: :->argument' && ret=0 case $state in command) @@ -71,7 +73,7 @@ case $state in case $words[2] in help) _message "Hit enter to get usage information" && ret=0 - ;; + ;; control) _message "Hit enter to get commands list" && ret=0 ;; @@ -88,215 +90,238 @@ case $state in _message "Hit enter to get plugin load time statistics" && ret=0 ;; load|light) - typeset -a plugins - plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) - plugins=( "${plugins[@]//---//}" ) - plugins=( "${plugins[@]:#_local/zi}" ) - plugins=( "${plugins[@]:#custom}" ) - _alternative 'plugins:-- Plugin --:compadd -a - plugins' 'directories:-- Directory --:_directories' && ret=0 - ;; - run|add-fpath) - typeset -a plugins - plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) - plugins=( "${plugins[@]//---//}" ) - plugins=( "${plugins[@]:#_local/zi}" ) - plugins=( "${plugins[@]:#custom}" ) - local -a opts - if [[ $words[2] = run ]]; then - opts=( -l ) - else - opts=( -f --front ) - fi - _alternative 'plugins:-- Plugin --:compadd -a - plugins' 'directories:-- Directory --:_directories' 'opts:-- Option --:compadd -a - opts' && ret=0 - ;; - compile|stress|edit|glance|recall|update|status|cd|changes|delete) - # Plugins - typeset -a plugins - plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) - plugins=( "${plugins[@]//---//}" ) - plugins=( "${plugins[@]:#_local/zi}" ) - plugins=( "${plugins[@]:#custom}" ) - # Snippets - local -a snippets snippets_alreadyld - local sni - snippets=( "${ZI[SNIPPETS_DIR]}"/**/._zi(D/:h) ) - snippets=( ${snippets[@]#${ZI[SNIPPETS_DIR]}/} ) - snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} ) - snippets=( ${snippets[@]/--//} ) - for sni ( ${snippets[@]} ) { - if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then - snippets_alreadyld+=( $sni ) - snippets=( ${snippets[@]:#$sni} ) - fi - } - _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ - 'plugins:-- Plugin --:compadd -a - plugins' && ret=0 - ;; - unload|report) - typeset -a plugins absolute normal - plugins=( "${ZI_REGISTERED_PLUGINS[@]:#_local/zi}" ) - normal=( "${plugins[@]:#%*}" ) - absolute=( "${(M)plugins[@]:#%*}" ) - absolute=( "${absolute[@]/\%\/\//%/}" ) - local hm="${HOME%/}" - absolute=( "${absolute[@]/$hm/HOME}" ) - plugins=( $normal $absolute ) - _wanted plugins expl "-- Plugin --" compadd "$@" -a - plugins && ret=0 - ;; - all-reports) - _message "Hit enter to get all reports (for all loaded plugins)" && ret=0 - ;; - loaded|list) - _message "Hit enter or give part of plugin name" && ret=0 - ;; - clist|completions) - _message "Hit enter to get list of completions" && ret=0 - ;; - cclear) - _message "Hit enter to clear stray and improper completions" && ret=0 - ;; - cdisable) - # Find enabled completions - typeset -a completions - completions=( "${ZI[COMPLETIONS_DIR]}"/_*(N:t) ) - completions=( "${completions[@]#_}" ) - _wanted plugins expl "-- Completion --" compadd "$@" -a - completions && ret=0 - ;; - cenable) - # Find disabled - typeset -a completions - completions=( "${ZI[COMPLETIONS_DIR]}"/[^_]*(N:t) ) - _wanted plugins expl "-- Completion --" compadd "$@" -a - completions && ret=0 - ;; - creinstall) - # Complete only plugins that have any completions - # We must iterate each plugin to check - # for completions that can be installed - typeset -a plugins completions - local p c user plugin - for p in "${ZI[PLUGINS_DIR]}"/*; do - completions=( "$p"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|_zsh_highlight*|/zsdoc/*)(DN) ) - for c in "${completions[@]}"; do - p="${p:t}" - user="${p%%---*}" - plugin="${p#*---}" - [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" - plugins+=( "${user:+$user/}$plugin" ) - break - done - done - _wanted plugins expl "-- Plugin --" compadd "$@" -a - plugins && ret=0 - ;; - cuninstall) - # We must iterate each plugin and check if - # it has completions that are installed - typeset -a plugins completions - local p c user plugin cfile bkpfile - for p in "${ZI[PLUGINS_DIR]}"/*; do - completions=( "$p"/**/_[^_.][^.]#(N) ) - for c in "${completions[@]}"; do - cfile="${c:t}" - bkpfile="${cfile#_}" - # Completion installed, either enabled or disabled? - if [[ -e "${ZI[COMPLETIONS_DIR]}"/"$cfile" || -e "${ZI[COMPLETIONS_DIR]}"/"$bkpfile" ]]; then - p="${p:t}" - user="${p%%---*}" - plugin="${p#*---}" - [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" - plugins+=( "${user:+$user/}$plugin" ) - break - fi - done - done - _wanted plugins expl "-- Plugin --" compadd "$@" -a - plugins && ret=0 - ;; - compinit) - _message "Hit enter to refresh completion system" && ret=0 - ;; - snippet) - local -a snippets snippets_alreadyld - local sni - snippets=( "${ZI[SNIPPETS_DIR]}"/**/._zi(D/:h) ) - snippets=( ${snippets[@]#${ZI[SNIPPETS_DIR]}/} ) - snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} ) - snippets=( ${snippets[@]/--//} ) - for sni ( ${snippets[@]} ) { - if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then - snippets_alreadyld+=( $sni ) - snippets=( ${snippets[@]:#$sni} ) - fi - } - _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ - 'files:-- File --:_files' && ret=0 - ;; - dstart|dtrace) - _message "Hit enter to start tracking this session" && ret=0 - ;; - dstop) - _message "Hit enter to stop tracking this session" && ret=0 - ;; - dunload) - _message "Hit enter to revert changes recorded between dstart and dstop" && ret=0 - ;; - dreport) - _message "Hit enter to show report of what was going on in session" && ret=0 - ;; - dclear) - _message "Hit enter to clear report of what was going on in session" && ret=0 - ;; - compile-all) - _message 'Hit enter to compile all downloaded plugins' && ret=0 - ;; - uncompile) - typeset -a plugins - plugins=( "${ZI[PLUGINS_DIR]}"/*(N) ) - typeset -a show_plugins p matches - for p in "${plugins[@]}"; do - matches=( $p/*.zwc(N) ) - if [ "$#matches" -ne "0" ]; then - p="${p:t}" - [ "$p" = "_local---zi" ] && continue - [ "$p" = "custom" ] && continue - p="${p//---//}" - show_plugins+=( "$p" ) - fi - done - _wanted show_plugins expl "-- Plugin --" compadd "$@" -a - show_plugins && ret=0 - ;; - uncompile-all) - _message 'Hit enter remove compiled versions of all downloaded plugins' && ret=0 - ;; - compiled) - _message 'Hit enter to get list of compiled plugins' && ret=0 - ;; - cdlist) - _message 'Hit enter to show compdef replay list' && ret=0 - ;; - cdreplay) - _message 'Hit enter to replay recorded compdefs' && ret=0 - ;; - cdclear) - _message 'Hit enter to clear compdef replay list' && ret=0 - ;; - recently) - typeset -a timespecs - timespecs=( - "3 days":"code modified during last 3 days" - "1 week":"code modified during last 7 days (default)" - "1 month":"code modified during last month" - ) - _describe -t timespecs "Time spec" timespecs && ret=0 - ;; - create) - _message 'Plugin spec or just enter, to create new plugin' && ret=0 - ;; - env-whitelist) - _wanted plugins expl "-- Parameter To White List During Any Plugin Unload --" _parameters && ret=0 - ;; - *) - ret=1 - ;; - esac + typeset -a plugins + plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) + plugins=( "${plugins[@]//---//}" ) + plugins=( "${plugins[@]:#_local/zi}" ) + plugins=( "${plugins[@]:#custom}" ) + _alternative \ + 'plugins:-- Plugin --:compadd -a - plugins' \ + 'directories:-- Directory --:_directories' && \ + ret=0 + ;; + run|add-fpath) + typeset -a plugins + plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) + plugins=( "${plugins[@]//---//}" ) + plugins=( "${plugins[@]:#_local/zi}" ) + plugins=( "${plugins[@]:#custom}" ) + local -a opts + if [[ $words[2] = run ]]; then + opts=( -l ) + else + opts=( -f --front ) + fi + _alternative \ + 'plugins:-- Plugin --:compadd -a - plugins' \ + 'directories:-- Directory --:_directories' \ + 'opts:-- Option --:compadd -a - opts' && \ + ret=0 + ;; + compile|stress|edit|glance|recall|update|status|cd|changes|delete) + # Plugins + typeset -a plugins + plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) ) + plugins=( "${plugins[@]//---//}" ) + plugins=( "${plugins[@]:#_local/zi}" ) + plugins=( "${plugins[@]:#custom}" ) + # Snippets + local -a snippets snippets_alreadyld + local sni + snippets=( "${ZI[SNIPPETS_DIR]}"/*/._zi(D/:h) ) + snippets=( ${snippets[@]#${ZI[SNIPPETS_DIR]}/} ) + snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} ) + snippets=( ${snippets[@]/--//} ) + for sni ( ${snippets[@]} ) { + if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then + snippets_alreadyld+=( $sni ) + snippets=( ${snippets[@]:#$sni} ) + fi + } + _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' \ + 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ + 'plugins:-- Plugin --:compadd -a - plugins' && \ + ret=0 + ;; + unload|report) + typeset -a plugins absolute normal + plugins=( "${ZI_REGISTERED_PLUGINS[@]:#_local/zi}" ) + normal=( "${plugins[@]:#%*}" ) + absolute=( "${(M)plugins[@]:#%*}" ) + absolute=( "${absolute[@]/\%\/\//%/}" ) + local hm="${HOME%/}" + absolute=( "${absolute[@]/$hm/HOME}" ) + plugins=( $normal $absolute ) + _wanted plugins expl "-- Plugin --" \ + compadd "$@" -a - plugins && \ + ret=0 + ;; + all-reports) + _message "Hit enter to get all reports (for all loaded plugins)" && ret=0 + ;; + loaded|list) + _message "Hit enter or give part of plugin name" && ret=0 + ;; + clist|completions) + _message "Hit enter to get list of completions" && ret=0 + ;; + cclear) + _message "Hit enter to clear stray and improper completions" && ret=0 + ;; + cdisable) + # Find enabled completions + typeset -a completions + completions=( "${ZI[COMPLETIONS_DIR]}"/_*(N:t) ) + completions=( "${completions[@]#_}" ) + _wanted plugins expl "-- Completion --" \ + compadd "$@" -a - completions && ret=0 + ;; + cenable) + # Find disabled + typeset -a completions + completions=( "${ZI[COMPLETIONS_DIR]}"/[^_]*(N:t) ) + _wanted plugins expl "-- Completion --" \ + compadd "$@" -a - completions && \ + ret=0 + ;; + creinstall) + # Complete only plugins that have any completions + # We must iterate each plugin to check + # for completions that can be installed + typeset -a plugins completions + local p c user plugin + for p in "${ZI[PLUGINS_DIR]}"/*; do + completions=( "$p"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|_zsh_highlight*|/zsdoc/*)(DN) ) + for c in "${completions[@]}"; do + p="${p:t}" + user="${p%%---*}" + plugin="${p#*---}" + [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" + plugins+=( "${user:+$user/}$plugin" ) + break + done + done + _wanted plugins expl "-- Plugin --" \ + compadd "$@" -a - plugins && \ + ret=0 + ;; + cuninstall) + # We must iterate each plugin and check if + # it has completions that are installed + typeset -a plugins completions + local p c user plugin cfile bkpfile + for p in "${ZI[PLUGINS_DIR]}"/*; do + completions=( "$p"/**/_[^_.][^.]#(N) ) + for c in "${completions[@]}"; do + cfile="${c:t}" + bkpfile="${cfile#_}" + # Completion installed, either enabled or disabled? + if [[ -e "${ZI[COMPLETIONS_DIR]}"/"$cfile" || -e "${ZI[COMPLETIONS_DIR]}"/"$bkpfile" ]]; then + p="${p:t}" + user="${p%%---*}" + plugin="${p#*---}" + [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" + plugins+=( "${user:+$user/}$plugin" ) + break + fi + done + done + _wanted plugins expl "-- Plugin --" \ + compadd "$@" -a - plugins && \ + ret=0 + ;; + compinit) + _message "Hit enter to refresh completion system" && ret=0 + ;; + snippet) + local -a snippets snippets_alreadyld + local sni + snippets=( "${ZI[SNIPPETS_DIR]}"/**/._zi(D/:h) ) + snippets=( ${snippets[@]#${ZI[SNIPPETS_DIR]}/} ) + snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} ) + snippets=( ${snippets[@]/--//} ) + for sni ( ${snippets[@]} ) { + if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then + snippets_alreadyld+=( $sni ) + snippets=( ${snippets[@]:#$sni} ) + fi + } + _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' \ + 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ + 'files:-- File --:_files' && \ + ret=0 + ;; + dstart|dtrace) + _message "Hit enter to start tracking this session" && ret=0 + ;; + dstop) + _message "Hit enter to stop tracking this session" && ret=0 + ;; + dunload) + _message "Hit enter to revert changes recorded between dstart and dstop" && ret=0 + ;; + dreport) + _message "Hit enter to show report of what was going on in session" && ret=0 + ;; + dclear) + _message "Hit enter to clear report of what was going on in session" && ret=0 + ;; + compile-all) + _message 'Hit enter to compile all downloaded plugins' && ret=0 + ;; + uncompile) + typeset -a plugins + plugins=( "${ZI[PLUGINS_DIR]}"/*(N) ) + typeset -a show_plugins p matches + for p in "${plugins[@]}"; do + matches=( $p/*.zwc(N) ) + if [ "$#matches" -ne "0" ]; then + p="${p:t}" + [ "$p" = "_local---zi" ] && continue + [ "$p" = "custom" ] && continue + p="${p//---//}" + show_plugins+=( "$p" ) + fi + done + _wanted show_plugins expl "-- Plugin --" \ + compadd "$@" -a - show_plugins && \ + ret=0 + ;; + uncompile-all) + _message 'Hit enter remove compiled versions of all downloaded plugins' && ret=0 + ;; + compiled) + _message 'Hit enter to get list of compiled plugins' && ret=0 + ;; + cdlist) + _message 'Hit enter to show compdef replay list' && ret=0 + ;; + cdreplay) + _message 'Hit enter to replay recorded compdefs' && ret=0 + ;; + cdclear) + _message 'Hit enter to clear compdef replay list' && ret=0 + ;; + recently) + typeset -a timespecs + timespecs=( + "3 days":"code modified during last 3 days" + "1 week":"code modified during last 7 days (default)" + "1 month":"code modified during last month" + ) + _describe -t timespecs "Time spec" timespecs && ret=0 + ;; + create) + _message 'Plugin spec or just enter, to create new plugin' && ret=0 + ;; + env-whitelist) + _wanted plugins expl "-- Parameter To White List During Any Plugin Unload --" \ + _parameters && ret=0 + ;; + *) + ret=1 + ;; + esac esac return $ret From 6b800e0f9a40864df10eec874f1d26546f7d2829 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 11:22:40 +0000 Subject: [PATCH 07/38] modified: lib/_zi --- lib/_zi | 137 +++++++++++++++++++++++--------------------------------- 1 file changed, 57 insertions(+), 80 deletions(-) diff --git a/lib/_zi b/lib/_zi index 3d395b5e..e5e3e51b 100755 --- a/lib/_zi +++ b/lib/_zi @@ -95,10 +95,7 @@ case $state in plugins=( "${plugins[@]//---//}" ) plugins=( "${plugins[@]:#_local/zi}" ) plugins=( "${plugins[@]:#custom}" ) - _alternative \ - 'plugins:-- Plugin --:compadd -a - plugins' \ - 'directories:-- Directory --:_directories' && \ - ret=0 + _alternative 'plugins:-- Plugin --:compadd -a - plugins' 'directories:-- Directory --:_directories' && ret=0 ;; run|add-fpath) typeset -a plugins @@ -108,15 +105,11 @@ case $state in plugins=( "${plugins[@]:#custom}" ) local -a opts if [[ $words[2] = run ]]; then - opts=( -l ) + opts=( -l ) else - opts=( -f --front ) + opts=( -f --front ) fi - _alternative \ - 'plugins:-- Plugin --:compadd -a - plugins' \ - 'directories:-- Directory --:_directories' \ - 'opts:-- Option --:compadd -a - opts' && \ - ret=0 + _alternative 'plugins:-- Plugin --:compadd -a - plugins' 'directories:-- Directory --:_directories' 'opts:-- Option --:compadd -a - opts' && ret=0 ;; compile|stress|edit|glance|recall|update|status|cd|changes|delete) # Plugins @@ -133,15 +126,13 @@ case $state in snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} ) snippets=( ${snippets[@]/--//} ) for sni ( ${snippets[@]} ) { - if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then - snippets_alreadyld+=( $sni ) - snippets=( ${snippets[@]:#$sni} ) - fi + if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then + snippets_alreadyld+=( $sni ) + snippets=( ${snippets[@]:#$sni} ) + fi } - _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' \ - 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ - 'plugins:-- Plugin --:compadd -a - plugins' && \ - ret=0 + _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ + 'plugins:-- Plugin --:compadd -a - plugins' && ret=0 ;; unload|report) typeset -a plugins absolute normal @@ -152,9 +143,7 @@ case $state in local hm="${HOME%/}" absolute=( "${absolute[@]/$hm/HOME}" ) plugins=( $normal $absolute ) - _wanted plugins expl "-- Plugin --" \ - compadd "$@" -a - plugins && \ - ret=0 + _wanted plugins expl "-- Plugin --" compadd "$@" -a - plugins && ret=0 ;; all-reports) _message "Hit enter to get all reports (for all loaded plugins)" && ret=0 @@ -173,16 +162,13 @@ case $state in typeset -a completions completions=( "${ZI[COMPLETIONS_DIR]}"/_*(N:t) ) completions=( "${completions[@]#_}" ) - _wanted plugins expl "-- Completion --" \ - compadd "$@" -a - completions && ret=0 + _wanted plugins expl "-- Completion --" compadd "$@" -a - completions && ret=0 ;; cenable) # Find disabled typeset -a completions completions=( "${ZI[COMPLETIONS_DIR]}"/[^_]*(N:t) ) - _wanted plugins expl "-- Completion --" \ - compadd "$@" -a - completions && \ - ret=0 + _wanted plugins expl "-- Completion --" compadd "$@" -a - completions && ret=0 ;; creinstall) # Complete only plugins that have any completions @@ -191,19 +177,17 @@ case $state in typeset -a plugins completions local p c user plugin for p in "${ZI[PLUGINS_DIR]}"/*; do - completions=( "$p"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|_zsh_highlight*|/zsdoc/*)(DN) ) - for c in "${completions[@]}"; do - p="${p:t}" - user="${p%%---*}" - plugin="${p#*---}" - [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" - plugins+=( "${user:+$user/}$plugin" ) - break - done + completions=( "$p"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|_zsh_highlight*|/zsdoc/*)(DN) ) + for c in "${completions[@]}"; do + p="${p:t}" + user="${p%%---*}" + plugin="${p#*---}" + [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" + plugins+=( "${user:+$user/}$plugin" ) + break + done done - _wanted plugins expl "-- Plugin --" \ - compadd "$@" -a - plugins && \ - ret=0 + _wanted plugins expl "-- Plugin --" compadd "$@" -a - plugins && ret=0 ;; cuninstall) # We must iterate each plugin and check if @@ -211,24 +195,22 @@ case $state in typeset -a plugins completions local p c user plugin cfile bkpfile for p in "${ZI[PLUGINS_DIR]}"/*; do - completions=( "$p"/**/_[^_.][^.]#(N) ) - for c in "${completions[@]}"; do - cfile="${c:t}" - bkpfile="${cfile#_}" - # Completion installed, either enabled or disabled? - if [[ -e "${ZI[COMPLETIONS_DIR]}"/"$cfile" || -e "${ZI[COMPLETIONS_DIR]}"/"$bkpfile" ]]; then - p="${p:t}" - user="${p%%---*}" - plugin="${p#*---}" - [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" - plugins+=( "${user:+$user/}$plugin" ) - break - fi - done + completions=( "$p"/**/_[^_.][^.]#(N) ) + for c in "${completions[@]}"; do + cfile="${c:t}" + bkpfile="${cfile#_}" + # Completion installed, either enabled or disabled? + if [[ -e "${ZI[COMPLETIONS_DIR]}"/"$cfile" || -e "${ZI[COMPLETIONS_DIR]}"/"$bkpfile" ]]; then + p="${p:t}" + user="${p%%---*}" + plugin="${p#*---}" + [[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user="" + plugins+=( "${user:+$user/}$plugin" ) + break + fi + done done - _wanted plugins expl "-- Plugin --" \ - compadd "$@" -a - plugins && \ - ret=0 + _wanted plugins expl "-- Plugin --" compadd "$@" -a - plugins && ret=0 ;; compinit) _message "Hit enter to refresh completion system" && ret=0 @@ -241,15 +223,13 @@ case $state in snippets=( ${snippets[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} ) snippets=( ${snippets[@]/--//} ) for sni ( ${snippets[@]} ) { - if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then - snippets_alreadyld+=( $sni ) - snippets=( ${snippets[@]:#$sni} ) - fi + if [[ -n ${ZI_SNIPPETS[$sni]} ]]; then + snippets_alreadyld+=( $sni ) + snippets=( ${snippets[@]:#$sni} ) + fi } - _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' \ - 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ - 'files:-- File --:_files' && \ - ret=0 + _alternative 'dsnippets:-- Downloaded Snippet --:compadd -a - snippets' 'lsnippets:-- Already Loaded Snippet --:compadd -a - snippets_alreadyld' \ + 'files:-- File --:_files' && ret=0 ;; dstart|dtrace) _message "Hit enter to start tracking this session" && ret=0 @@ -274,18 +254,16 @@ case $state in plugins=( "${ZI[PLUGINS_DIR]}"/*(N) ) typeset -a show_plugins p matches for p in "${plugins[@]}"; do - matches=( $p/*.zwc(N) ) - if [ "$#matches" -ne "0" ]; then - p="${p:t}" - [ "$p" = "_local---zi" ] && continue - [ "$p" = "custom" ] && continue - p="${p//---//}" - show_plugins+=( "$p" ) - fi + matches=( $p/*.zwc(N) ) + if [ "$#matches" -ne "0" ]; then + p="${p:t}" + [ "$p" = "_local---zi" ] && continue + [ "$p" = "custom" ] && continue + p="${p//---//}" + show_plugins+=( "$p" ) + fi done - _wanted show_plugins expl "-- Plugin --" \ - compadd "$@" -a - show_plugins && \ - ret=0 + _wanted show_plugins expl "-- Plugin --" compadd "$@" -a - show_plugins && ret=0 ;; uncompile-all) _message 'Hit enter remove compiled versions of all downloaded plugins' && ret=0 @@ -305,9 +283,9 @@ case $state in recently) typeset -a timespecs timespecs=( - "3 days":"code modified during last 3 days" - "1 week":"code modified during last 7 days (default)" - "1 month":"code modified during last month" + "3 days":"code modified during last 3 days" + "1 week":"code modified during last 7 days (default)" + "1 month":"code modified during last month" ) _describe -t timespecs "Time spec" timespecs && ret=0 ;; @@ -315,8 +293,7 @@ case $state in _message 'Plugin spec or just enter, to create new plugin' && ret=0 ;; env-whitelist) - _wanted plugins expl "-- Parameter To White List During Any Plugin Unload --" \ - _parameters && ret=0 + _wanted plugins expl "-- Parameter To White List During Any Plugin Unload --" _parameters && ret=0 ;; *) ret=1 From 7be8b4d3735c9dc4b4d970edfd25baff274489c2 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 19:21:37 +0000 Subject: [PATCH 08/38] Update .editorconfig --- .editorconfig | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.editorconfig b/.editorconfig index 1e1705f7..3402a3ed 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,6 +5,7 @@ root = true [*] indent_style = space +tab_width = 8 indent_size = 2 charset = utf-8 end_of_line = lf @@ -13,3 +14,11 @@ insert_final_newline = true [**.{md,rst}] trim_trailing_whitespace = false + +[*.[ch]] +indent_style = tab +indent_size = 4 + +[ChangeLog] +indent_style = tab +indent_size = 8 From e865df1670cf97446d98c966a247e51a025ac1f8 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 19:29:52 +0000 Subject: [PATCH 09/38] Update README.md --- docs/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index 4aaf7096..ee73ec88 100644 --- a/docs/README.md +++ b/docs/README.md @@ -111,19 +111,19 @@ Further releases of ❮ ZI ❯ will have Visual Studio Code workspace pre-config ## Authors & contributors -The original setup of this repository is by [Z-Shell ❮ ZI ❯ Community](https://github.com/z-shell). +The original setup of this repository is by [Z-Shell ZI Community](https://github.com/z-shell). For a full list of all authors and contributors, see [the contributors page](https://github.com/z-shell/zi/contributors). ## Project assistance -If you want to say **thank you** or/and support active development of Z-Shell ❮ ZI ❯: +If you want to say **thank you** or/and support active development of Z-Shell ZI : - Add a [GitHub Star](https://github.com/z-shell/zi) to the project. -- Tweet about the Z-Shell ❮ ZI ❯. +- Tweet about the ❮ ZI ❯. - Write interesting articles about the project on [Dev.to](https://dev.to/), [Medium](https://medium.com/) or your personal blog. -Together, we can make Z-Shell ❮ ZI ❯ **better**! +Together, we can make Z-Shell ZI **better**! ## Security From 107a346dda97c69f6710c2e9318ad59dcce2324b Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 20:15:43 +0000 Subject: [PATCH 10/38] Update .editorconfig --- .editorconfig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 3402a3ed..1fa2f4ab 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,7 +4,7 @@ root = true [*] -indent_style = space +indent_style = tab tab_width = 8 indent_size = 2 charset = utf-8 @@ -15,10 +15,22 @@ insert_final_newline = true [**.{md,rst}] trim_trailing_whitespace = false +[*.{yml,yaml}] +indent_style = space +tab_width = 4 + [*.[ch]] indent_style = tab indent_size = 4 +[*.{sh,bash,zsh,fish}] +indent_style = space +tab_width = 2 + [ChangeLog] indent_style = tab indent_size = 8 + +[Makefile] +indent_style = tab +indent_size = 4 From 5659c47636c57157bc0e74cf7694a9a03195a9be Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 20:23:24 +0000 Subject: [PATCH 11/38] Update .editorconfig --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 1fa2f4ab..d530de17 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,7 +5,7 @@ root = true [*] indent_style = tab -tab_width = 8 +tab_width = 2 indent_size = 2 charset = utf-8 end_of_line = lf From 882a44123a677be87aea809ea406a5dc8c76dd2a Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 21:02:20 +0000 Subject: [PATCH 12/38] updates links --- zi.zsh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zi.zsh b/zi.zsh index f3c0675c..0005d8d8 100755 --- a/zi.zsh +++ b/zi.zsh @@ -92,7 +92,7 @@ ZI[LEFTAR]=";:^[[D;:^[OD;:\\e[D;:\\eOD;:${termcap[kl]/$'\e'/^\[};:${terminfo[kcu builtin autoload -Uz is-at-least is-at-least 5.1 && ZI[NEW_AUTOLOAD]=1 || ZI[NEW_AUTOLOAD]=0 -is-at-least 5.4 && ZI[NEW_AUTOLOAD]=2 +#is-at-least 5.4 && ZI[NEW_AUTOLOAD]=2 # Parameters - temporary substituting of functions. [[[ ZI[TMP_SUBST]=inactive ZI[DTRACE]=0 ZI[CUR_PLUGIN]= @@ -718,8 +718,7 @@ builtin setopt noaliases [[ $cmd = begin ]] && { [[ -z ${ZI[FUNCTIONS_BEFORE__$uspl2]} ]] && ZI[FUNCTIONS_BEFORE__$uspl2]="${(j: :)${(qk)functions[@]}}" } || ZI[FUNCTIONS_AFTER__$uspl2]+=" ${(j: :)${(qk)functions[@]}}" } # ]]] # FUNCTION: .zi-diff-options. [[[ -# Implements detection of change in option state. Performs -# data gathering, computation is done in *-compute(). +# Implements detection of change in option state. Performs data gathering, computation is done in *-compute(). # # $1 - user/plugin (i.e. uspl2 format) # $2 - command, can be "begin" or "end" @@ -894,7 +893,7 @@ builtin setopt noaliases # FUNCTION: .zi-register-plugin. [[[ # Adds the plugin to ZI_REGISTERED_PLUGINS array and to the # zsh_loaded_plugins array (managed according to the plugin standard: -# http://z-shell.github.io/ZSH-TOP-100/Zsh-Plugin-Standard.html). +# https://github.com/z-shell/zi/wiki/Zsh-Plugin-Standard). .zi-register-plugin() { local uspl2="$1" mode="$2" teleid="$3" integer ret=0 @@ -1011,7 +1010,7 @@ builtin setopt noaliases } # ]]] # FUNCTION: @zsh-plugin-run-on-update. [[[ # The Plugin Standard required mechanism, see: -# http://z-shell.github.io/ZSH-TOP-100/Zsh-Plugin-Standard.html +# https://github.com/z-shell/zi/wiki/Zsh-Plugin-Standard @zsh-plugin-run-on-unload() { ICE[ps-on-unload]="${(j.; .)@}" .zi-pack-ice "$id_as" "" From ac121ae7b1963ceb2bb236662a41f08a70307d7d Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Mon, 6 Dec 2021 23:15:20 +0000 Subject: [PATCH 13/38] adjusts messages --- docs/CONTRIBUTING.md | 8 ++++---- zi.zsh | 29 ++++++++++++----------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index d4379fd6..c07884cb 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -10,7 +10,7 @@ Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in > **[?]** > Useful information about Zsh. -- [Zsh Site](http://zsh.sourceforge.net/) +- [Zsh Site](http://zsh.sourceforge.net/) - [Zsh FAQ](https://zsh.sourceforge.io/FAQ/) - [Zsh Doc](https://zsh.sourceforge.io/Doc/) > @@ -18,9 +18,9 @@ Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in - [Zsh tips](http://www.zzapper.co.uk/zshtips.html) - [101 Powerful & Practical ZSH GLOBS](http://www.zzapper.co.uk/101ZshGlobs.php) - [Practical differences between Bash ans Zsh](https://apple.stackexchange.com/questions/361870/what-are-the-practical-differences-between-bash-and-zsh/361957#361957) -> +> - [zshdb - a gdb-like debugger for zsh](https://zshdb.readthedocs.io/en/latest/index.html) -- [Debian Bug report logs: Bugs in package zsh](https://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=zsh) +- [Debian Bug report logs: Bugs in package zsh](https://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=zsh) ## Development environment setup @@ -48,7 +48,7 @@ Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in your extra branch(es). > **[?]** -> Always write your commit messages in the present tense. Your commit message should describe what the commit, when applied, does to the code – not what you did to the code. +> Always write your commit messages in the present tense. Your commit message should describe what the commit, when applied, does to the code – not what you did to the code. ([examples](https://www.google.com/search?q=english+"present+tense+example")) ## Issues and feature requests diff --git a/zi.zsh b/zi.zsh index 0005d8d8..6105965a 100755 --- a/zi.zsh +++ b/zi.zsh @@ -1387,7 +1387,7 @@ builtin setopt noaliases .zi-load-plugin "$___user" "$___plugin" "$___id_as" "$___mode" "$___rst"; ___retval=$? (( ${+ICE[notify]} == 1 )) && { [[ $___retval -eq 0 || -n ${(M)ICE[notify]#\!} ]] && { local msg; eval "msg=\"${ICE[notify]#\!}\""; +zi-deploy-message @msg "$msg" } || +zi-deploy-message @msg "notify: Plugin not loaded / loaded with problem, the return code: $___retval"; } (( ${+ICE[reset-prompt]} == 1 )) && +zi-deploy-message @___rst - # Retire feature `m`. + # Unset the `m` function. .zi-set-m-func unset # Mark no load is in progress. ZI[CUR_USR]= ZI[CUR_PLUGIN]= ZI[CUR_USPL2]= @@ -1625,10 +1625,10 @@ builtin setopt noaliases # FUNCTION: .zi-formatter-pid. [[[ .zi-formatter-pid() { builtin emulate -L zsh -o extendedglob - # Remember extreme whitespace. + # Save whitespace location local pbz=${(M)1##(#s)[[:space:]]##} local kbz=${(M)1%%[[:space:]]##(#e)} - # Remove extreme whitespace. + # Trim leading/trailing whitespace 1=${1//((#s)[[:space:]]##|[[:space:]]##(#e))/} ((${+functions[.zi-first]})) || source ${ZI[BIN_DIR]}/lib/zsh/side.zsh .zi-any-colorify-as-uspl2 "$1"; @@ -1637,7 +1637,7 @@ builtin setopt noaliases pbz=${pbz/[[:blank:]]/ } local kbz_rev="${(j::)${(@Oas::)kbz}}" kbz="${(j::)${(@Oas::)${kbz_rev/[[:blank:]]/ }}}" - # Supply extreme whitespace back. + # Restore whitespace location REPLY=$pbz$REPLY$kbz } # ]]] # FUNCTION: .zi-formatter-bar. [[[ @@ -1693,6 +1693,7 @@ builtin setopt noaliases fi local append influx in_prepend if [[ $2 == (b|u|it|st|nb|nu|nit|nst) ]]; then + # Code repetition to preserve any leading/trailing whitespace and to allow accumulation of this code with others. append=$ZI[col-$2] elif [[ $2 == (…|ndsh|mdsh|mmdsh|-…|lr|) || -z $2 || -z $ZI[col-$2] ]]; then # Resume previous escape code, if stored. @@ -1701,6 +1702,7 @@ builtin setopt noaliases influx=$ZI[col-$ZI[__last-formatter-code]] fi else + # End of escaping logic append=$ZI[col-rst] fi # Construct the text. @@ -1723,14 +1725,11 @@ builtin setopt noaliases # First try a dedicated formatter, marking its empty output with ←→, then # the general formatter and in the end filter-out the ←→ from the message. -msg=${${msg//(#b)(([\\]|(%F))([\{]([^\}]##)[\}])|([\{]([^\}]##)[\}])([^\%\{\\]#))/\ -${match[4]:+${${match[3]:-$ZI[col-${ZI[__last-formatter-code]}]}:#%F}}$match[3]$match[4]\ -${${functions[.zi-formatter-$match[7]]:+${$(.zi-formatter-$match[7] "$match[8]"; builtin print -rn -- $REPLY):-←→}}:-\ -$(.zi-main-message-formatter "$match[6]" "$match[7]" "$match[8]"; \ +msg=${${msg//(#b)(([\\]|(%F))([\{]([^\}]##)[\}])|([\{]([^\}]##)[\}])([^\%\{\\]#))/${match[4]:+${${match[3]:-$ZI[col-${ZI[__last-formatter-code]}]}:#%F}}$match[3]$match[4]\ +${${functions[.zi-formatter-$match[7]]:+${$(.zi-formatter-$match[7] "$match[8]"; builtin print -rn -- $REPLY):-←→}}:-$(.zi-main-message-formatter "$match[6]" "$match[7]" "$match[8]"; \ builtin print -rn -- "$REPLY" )${${ZI[__last-formatter-code]::=${${${match[7]:#(…|ndsh|mdsh|mmdsh|-…|lr)}:+$match[7]}:-${ZI[__last-formatter-code]}}}:+}}}//←→} - - # Restore the default color at the end of the message. + # Reset color attributes at the end of the message. msg=$msg$ZI[col-rst] # Output the processed message: builtin print -Pr ${opt:#--} -- $msg @@ -1749,8 +1748,7 @@ $(.zi-main-message-formatter "$match[6]" "$match[7]" "$match[8]"; \ # -h/--help given? if (( OPTS[opt_-h,--help] )) { # Yes – a help message: - +zi-message "{lhi}HELP FOR {apo}\`{cmd}$cmd{apo}\`{lhi} subcommand {mdsh}" \ - "the available {b-lhi}options{ehi}:{rst}" + +zi-message "{lhi}HELP FOR {apo}\`{cmd}$cmd{apo}\`{lhi} subcommand {mdsh}" "the available {b-lhi}options{ehi}:{rst}" local opt for opt ( ${(kos:|:)allowed} ) { [[ $opt == --* ]] && continue @@ -1765,11 +1763,8 @@ $(.zi-main-message-formatter "$match[6]" "$match[7]" "$match[8]"; \ } elif [[ -n $allowed ]] { shift 2 # No – an error message: - +zi-message "{b}{u-warn}ERROR{b-warn}:{rst}{msg2} Incorrect options given{ehi}:" \ - "${(Mpj:$sep:)@:#-*}{rst}{msg2}. Allowed for the subcommand{ehi}:{rst}" \ - "{apo}\`{cmd}$cmd{apo}\`{msg2} are{ehi}:{rst}" \ - "{nl}{mmdsh} {opt}${allowed//\|/$sep2}{msg2}." \ - "{nl}{…} Aborting.{rst}" + +zi-message "{b}{u-warn}ERROR{b-warn}:{rst}{msg2} Incorrect options given{ehi}:" "${(Mpj:$sep:)@:#-*}{rst}{msg2}. Allowed for the subcommand{ehi}:{rst}" \ + "{apo}\`{cmd}$cmd{apo}\`{msg2} are{ehi}:{rst}" "{nl}{mmdsh} {opt}${allowed//\|/$sep2}{msg2}." "{nl}{…} Aborting.{rst}" } else { local -a cmds cmds=( load snippet update delete ) From b48faab0e2f6b87940f5e0a201a6625e0d8e300c Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:03:15 +0000 Subject: [PATCH 14/38] Update and rename zi-lint.yml to zi-lint.md --- .github/workflows/{zi-lint.yml => zi-lint.md} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{zi-lint.yml => zi-lint.md} (89%) diff --git a/.github/workflows/zi-lint.yml b/.github/workflows/zi-lint.md similarity index 89% rename from .github/workflows/zi-lint.yml rename to .github/workflows/zi-lint.md index 594ad036..611ae4e6 100644 --- a/.github/workflows/zi-lint.yml +++ b/.github/workflows/zi-lint.md @@ -1,4 +1,4 @@ -name: ZI Lint +name: 🌟 ZI Lint on: pull_request_target: @@ -14,7 +14,7 @@ jobs: - name: "✨ Set matrix output" id: set-matrix run: | - MATRIX="$(find . -type d -name 'doc' -prune -o -type f -iname '*.zsh' -print | jq -ncR '{"include": [{"file": inputs}]}')" + MATRIX="$(find . -type d -name 'doc' -prune -o -type f \(-iname '*.zsh' -name '_zi' \) -print | jq -ncR '{"include": [{"file": inputs}]}')" echo "MATRIX=${MATRIX}" >&2 echo "::set-output name=matrix::${MATRIX}" lint: From e80dc45a9848ad2456a38f1eea8ec6fa986d8540 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:04:34 +0000 Subject: [PATCH 15/38] Rename zi-lint.md to zi-lint.yml --- .github/workflows/{zi-lint.md => zi-lint.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{zi-lint.md => zi-lint.yml} (100%) diff --git a/.github/workflows/zi-lint.md b/.github/workflows/zi-lint.yml similarity index 100% rename from .github/workflows/zi-lint.md rename to .github/workflows/zi-lint.yml From bb6f8cc615ca52f17d03ba9adce8eae09fe8db48 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:05:31 +0000 Subject: [PATCH 16/38] Update zi-lint.yml --- .github/workflows/zi-lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/zi-lint.yml b/.github/workflows/zi-lint.yml index 611ae4e6..44b015a0 100644 --- a/.github/workflows/zi-lint.yml +++ b/.github/workflows/zi-lint.yml @@ -1,6 +1,7 @@ name: 🌟 ZI Lint on: + workflow_dispatch: pull_request_target: jobs: From f9cb7211fd515fe74a6ad7eba9e4f16794d54efc Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:07:00 +0000 Subject: [PATCH 17/38] Update zi-lint.yml --- .github/workflows/zi-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zi-lint.yml b/.github/workflows/zi-lint.yml index 44b015a0..b3754328 100644 --- a/.github/workflows/zi-lint.yml +++ b/.github/workflows/zi-lint.yml @@ -15,7 +15,7 @@ jobs: - name: "✨ Set matrix output" id: set-matrix run: | - MATRIX="$(find . -type d -name 'doc' -prune -o -type f \(-iname '*.zsh' -name '_zi' \) -print | jq -ncR '{"include": [{"file": inputs}]}')" + MATRIX="$(find . -type d -name 'doc' -prune -o -type f ( -iname '*.zsh' -name '_zi' ) -print | jq -ncR '{"include": [{"file": inputs}]}')" echo "MATRIX=${MATRIX}" >&2 echo "::set-output name=matrix::${MATRIX}" lint: From f0b8034995758bb1dff732853aa2281cb18fc853 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:08:51 +0000 Subject: [PATCH 18/38] Update zi-lint.yml --- .github/workflows/zi-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zi-lint.yml b/.github/workflows/zi-lint.yml index b3754328..358e94fa 100644 --- a/.github/workflows/zi-lint.yml +++ b/.github/workflows/zi-lint.yml @@ -15,7 +15,7 @@ jobs: - name: "✨ Set matrix output" id: set-matrix run: | - MATRIX="$(find . -type d -name 'doc' -prune -o -type f ( -iname '*.zsh' -name '_zi' ) -print | jq -ncR '{"include": [{"file": inputs}]}')" + MATRIX="$(find . -type d -name 'doc' -prune -o -type f -iname '*.zsh' -o -iname '_zi' -print | jq -ncR '{"include": [{"file": inputs}]}')" echo "MATRIX=${MATRIX}" >&2 echo "::set-output name=matrix::${MATRIX}" lint: From 6b36e894333c84289a24e101e4b619e26889c9a2 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:11:16 +0000 Subject: [PATCH 19/38] Update zi-lint.yml --- .github/workflows/zi-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zi-lint.yml b/.github/workflows/zi-lint.yml index 358e94fa..e0d42c41 100644 --- a/.github/workflows/zi-lint.yml +++ b/.github/workflows/zi-lint.yml @@ -15,7 +15,7 @@ jobs: - name: "✨ Set matrix output" id: set-matrix run: | - MATRIX="$(find . -type d -name 'doc' -prune -o -type f -iname '*.zsh' -o -iname '_zi' -print | jq -ncR '{"include": [{"file": inputs}]}')" + MATRIX="$(find . -type d -name 'doc' -prune -o -type f ( -iname '*.zsh' -o -iname '_zi' ) -print | jq -ncR '{"include": [{"file": inputs}]}')" echo "MATRIX=${MATRIX}" >&2 echo "::set-output name=matrix::${MATRIX}" lint: From 68ce6c412b26a4156755dfdae31e644fd5cff2a4 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:14:08 +0000 Subject: [PATCH 20/38] Update zi-lint.yml --- .github/workflows/zi-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zi-lint.yml b/.github/workflows/zi-lint.yml index e0d42c41..e42ad6a0 100644 --- a/.github/workflows/zi-lint.yml +++ b/.github/workflows/zi-lint.yml @@ -15,7 +15,7 @@ jobs: - name: "✨ Set matrix output" id: set-matrix run: | - MATRIX="$(find . -type d -name 'doc' -prune -o -type f ( -iname '*.zsh' -o -iname '_zi' ) -print | jq -ncR '{"include": [{"file": inputs}]}')" + MATRIX="$(find . -type d -name 'doc' -prune -o -type f \( -iname '*.zsh' -o -iname '_zi' \) -print | jq -ncR '{"include": [{"file": inputs}]}')" echo "MATRIX=${MATRIX}" >&2 echo "::set-output name=matrix::${MATRIX}" lint: From 7a9e445c500326466d0a3872f8ca26d451891f85 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:17:57 +0000 Subject: [PATCH 21/38] Update sync-labels.yml --- .github/workflows/sync-labels.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 968c89ba..0da39202 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -1,7 +1,9 @@ --- -name: Sync Labels +name: ♻️ Sync Labels on: + schedule: + - cron: "20 2 * * 2" push: branches: - main From a61bf949482a7eb1d3e3c237e2fdedde852113cb Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:22:28 +0000 Subject: [PATCH 22/38] Update lock.yml --- .github/workflows/lock.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index 65cbeb71..445fbe77 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -1,9 +1,9 @@ --- -name: Lock closed issues and PRs +name: 🔒 Lock closed issues and PRs on: schedule: - - cron: "0 9 * * *" + - cron: "30 2 * * *" workflow_dispatch: jobs: From eef96aeea672d56e5b894bee9e35d00fa415a3ed Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:25:31 +0000 Subject: [PATCH 23/38] Update codeql.yml --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a14f9a43..6809ce09 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,5 +1,5 @@ --- -name: CodeQL +name: 👾 CodeQL on: # push: From 586f740fbeb4cd9fd6096905c652059dad1c587d Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:26:50 +0000 Subject: [PATCH 24/38] Update pr-labels.yml --- .github/workflows/pr-labels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 2865d9fd..4080789e 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -1,10 +1,10 @@ --- -name: Verify PR Labels +name: 🏷️ Verify PR Labels on: workflow_dispatch: pull_request_target: - types: ['opened', 'labeled', 'unlabeled', 'synchronize' ] + types: [ 'opened', 'labeled', 'unlabeled', 'synchronize' ] jobs: pr_labels: From 4c96de64b7bbd154751c96ce67c36ac2ab487fca Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 01:27:16 +0000 Subject: [PATCH 25/38] Update stale.yml --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index eb8e6c25..fc940f8f 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,5 +1,5 @@ --- -name: Stale +name: 🧹 Stale on: schedule: From ae0354c796c21edfc0c0bd0a00035b69162fd907 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 03:16:14 +0000 Subject: [PATCH 26/38] Update .editorconfig --- .editorconfig | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.editorconfig b/.editorconfig index d530de17..6de79a47 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,12 +4,8 @@ root = true [*] -indent_style = tab -tab_width = 2 -indent_size = 2 charset = utf-8 end_of_line = lf -trim_trailing_whitespace = true insert_final_newline = true [**.{md,rst}] @@ -17,20 +13,18 @@ trim_trailing_whitespace = false [*.{yml,yaml}] indent_style = space -tab_width = 4 - -[*.[ch]] -indent_style = tab -indent_size = 4 +tab_width = 4 [*.{sh,bash,zsh,fish}] indent_style = space -tab_width = 2 +tab_width = 2 +trim_trailing_whitespace = true -[ChangeLog] +[*.{js,jsx,html,sass}] indent_style = tab -indent_size = 8 +indent_size = 4 +trim_trailing_whitespace = true -[Makefile] +[ChangeLog] indent_style = tab -indent_size = 4 +indent_size = 8 From 76ec3a6ebc8b14e45f7a59eea604f65d2d242008 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 05:09:28 +0000 Subject: [PATCH 27/38] Update pr-labels.yml --- .github/workflows/pr-labels.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml index 4080789e..d082a9f4 100644 --- a/.github/workflows/pr-labels.yml +++ b/.github/workflows/pr-labels.yml @@ -11,20 +11,20 @@ jobs: name: 🏭 Verify PR Labels runs-on: ubuntu-latest steps: - - name: Update and get pip cache dir + - name: 📥 Update and get pip cache dir id: pip-cache run: | python -m pip install --upgrade pip echo "::set-output name=dir::$(pip cache dir)" - - name: Restore pip cache + - name: 📤 Restore pip cache uses: actions/cache@v2 with: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - + - name: 🏷 Verify PR has a valid label uses: jesusvasquez333/verify-pr-label-action@v1.4.0 with: From 36521ab573b3b11fd4378ded04bdc56529577480 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 16:13:10 +0000 Subject: [PATCH 28/38] FUNCTION: .zi-turbo --- lib/zsh/autoload.zsh | 15 ++++++++++++++- zi.zsh | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/zsh/autoload.zsh b/lib/zsh/autoload.zsh index 2d81ae5c..d3875e51 100755 --- a/lib/zsh/autoload.zsh +++ b/lib/zsh/autoload.zsh @@ -2966,7 +2966,20 @@ EOF } builtin print $EPOCHSECONDS >! "${ZI[ZMODULES_DIR]}/zpmod/COMPILED_AT" ) -} # ]]] +} +# ]]] +# FUNCTION: .zi-turbo [[[ +# ZI simplified Turbo mode. +# # Allows to specify load group of plugins in order. +# Allowed group values [0-9][a-d], default depth set to 3. +# e.g. '0a' first, '0b' for second, '2a' for third and '9d' the last possible etc. +# +# zt '0a' for some-first-plugin +# zt '0b' for \ +# some-plugin \ +# another-plugin +.zi-turbo() { zi depth'3' lucid ${1/#[0-9][a-d]/wait"${1}"} "${@:2}"; } +# ]]] # # Help function diff --git a/zi.zsh b/zi.zsh index 6105965a..1c706ff1 100755 --- a/zi.zsh +++ b/zi.zsh @@ -2620,6 +2620,8 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice (-h|help) .zi-help ;; + (zt) + .zi-turbo (ls) shift .zi-ls "$@" @@ -2680,7 +2682,6 @@ zicompdef() { ZI_COMPDEF_REPLAY+=( "${(j: :)${(q)@}}" ); } ${${${(@M)${@#\!}:#*(->|=>|→)*}}:+-C} ${${@#\!}:+-C} } # ]]] # Compatibility functions. [[[ -zt() { zi depth'3' lucid ${1/#[0-9][a-d]/wait"${1}"} "${@:2}"; } zinit() { zi "$@"; } zpcdreplay() { .zi-compdef-replay -q; } zpcdclear() { .zi-compdef-clear -q; } From 8f05a5f239db765368678e09b64691ec8c3a51b4 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 16:16:36 +0000 Subject: [PATCH 29/38] cmd zt reg --- zi.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zi.zsh b/zi.zsh index 1c706ff1..03eaf847 100755 --- a/zi.zsh +++ b/zi.zsh @@ -2151,7 +2151,7 @@ zi() { reply=( ${ZI_EXTS[(I)z-annex subcommand:*]} ) - [[ -n $1 && $1 != (-h|--help|help|analytics|control|man|self-update|times|zstatus|load|light|unload|snippet|ls|ice|\ + [[ -n $1 && $1 != (-h|--help|help|analytics|control|man|self-update|times|zstatus|load|light|unload|snippet|ls|zt|ice|\ update|status|report|delete|loaded|list|cd|create|edit|glance|stress|changes|recently|clist|\ completions|cclear|cdisable|cenable|creinstall|cuninstall|csearch|compinit|dtrace|dstart|dstop|\ dunload|dreport|dclear|compile|uncompile|compiled|cdlist|cdreplay|cdclear|srv|recall|\ From 77b41ea009ade61426100fab655dc3143e4aaa6e Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 16:18:06 +0000 Subject: [PATCH 30/38] case fix --- zi.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/zi.zsh b/zi.zsh index 03eaf847..b50863f7 100755 --- a/zi.zsh +++ b/zi.zsh @@ -2622,6 +2622,7 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice ;; (zt) .zi-turbo + ;; (ls) shift .zi-ls "$@" From 0478e4904f52dfda99c2c050568f06c586d9d100 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 16:25:21 +0000 Subject: [PATCH 31/38] reg cmd turbo --- lib/zsh/autoload.zsh | 4 ++-- zi.zsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/zsh/autoload.zsh b/lib/zsh/autoload.zsh index d3875e51..8d831a40 100755 --- a/lib/zsh/autoload.zsh +++ b/lib/zsh/autoload.zsh @@ -2974,8 +2974,8 @@ EOF # Allowed group values [0-9][a-d], default depth set to 3. # e.g. '0a' first, '0b' for second, '2a' for third and '9d' the last possible etc. # -# zt '0a' for some-first-plugin -# zt '0b' for \ +# zi turbo '0a' for some-first-plugin +# zi turbo '0b' for \ # some-plugin \ # another-plugin .zi-turbo() { zi depth'3' lucid ${1/#[0-9][a-d]/wait"${1}"} "${@:2}"; } diff --git a/zi.zsh b/zi.zsh index b50863f7..b56c3ab6 100755 --- a/zi.zsh +++ b/zi.zsh @@ -2151,7 +2151,7 @@ zi() { reply=( ${ZI_EXTS[(I)z-annex subcommand:*]} ) - [[ -n $1 && $1 != (-h|--help|help|analytics|control|man|self-update|times|zstatus|load|light|unload|snippet|ls|zt|ice|\ + [[ -n $1 && $1 != (-h|--help|help|analytics|control|man|self-update|times|zstatus|load|light|unload|snippet|ls|turbo|ice|\ update|status|report|delete|loaded|list|cd|create|edit|glance|stress|changes|recently|clist|\ completions|cclear|cdisable|cenable|creinstall|cuninstall|csearch|compinit|dtrace|dstart|dstop|\ dunload|dreport|dclear|compile|uncompile|compiled|cdlist|cdreplay|cdclear|srv|recall|\ @@ -2620,7 +2620,7 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice (-h|help) .zi-help ;; - (zt) + (turbo) .zi-turbo ;; (ls) From 6b2fd45dc9fe6772c377975e89d61fd1dfa17752 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 16:39:10 +0000 Subject: [PATCH 32/38] add zi-turbo func --- lib/zsh/autoload.zsh | 12 ------------ zi.zsh | 11 +++++++---- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/lib/zsh/autoload.zsh b/lib/zsh/autoload.zsh index 8d831a40..1e8bc2ee 100755 --- a/lib/zsh/autoload.zsh +++ b/lib/zsh/autoload.zsh @@ -2968,18 +2968,6 @@ EOF ) } # ]]] -# FUNCTION: .zi-turbo [[[ -# ZI simplified Turbo mode. -# # Allows to specify load group of plugins in order. -# Allowed group values [0-9][a-d], default depth set to 3. -# e.g. '0a' first, '0b' for second, '2a' for third and '9d' the last possible etc. -# -# zi turbo '0a' for some-first-plugin -# zi turbo '0b' for \ -# some-plugin \ -# another-plugin -.zi-turbo() { zi depth'3' lucid ${1/#[0-9][a-d]/wait"${1}"} "${@:2}"; } -# ]]] # # Help function diff --git a/zi.zsh b/zi.zsh index b56c3ab6..773ca5f4 100755 --- a/zi.zsh +++ b/zi.zsh @@ -2151,7 +2151,7 @@ zi() { reply=( ${ZI_EXTS[(I)z-annex subcommand:*]} ) - [[ -n $1 && $1 != (-h|--help|help|analytics|control|man|self-update|times|zstatus|load|light|unload|snippet|ls|turbo|ice|\ + [[ -n $1 && $1 != (-h|--help|help|analytics|control|man|self-update|times|zstatus|load|light|unload|snippet|ls|ice|\ update|status|report|delete|loaded|list|cd|create|edit|glance|stress|changes|recently|clist|\ completions|cclear|cdisable|cenable|creinstall|cuninstall|csearch|compinit|dtrace|dstart|dstop|\ dunload|dreport|dclear|compile|uncompile|compiled|cdlist|cdreplay|cdclear|srv|recall|\ @@ -2620,9 +2620,6 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice (-h|help) .zi-help ;; - (turbo) - .zi-turbo - ;; (ls) shift .zi-ls "$@" @@ -2682,6 +2679,12 @@ zicompdef() { ZI_COMPDEF_REPLAY+=( "${(j: :)${(q)@}}" ); } ${(s: :)${${(j: :)${@#\!}}//(#b)((*)(->|=>|→)(*)|(*))/${match[2]:+$match[2] -S $match[4]}${match[5]:+${match[5]} -S ${match[5]}}}} \ ${${${(@M)${@#\!}:#*(->|=>|→)*}}:+-C} ${${@#\!}:+-C} } # ]]] +# FUNCTION: zi-turbo. [[[ +# ZI simplified Turbo mode. +# Allows to specify load group of plugins in order. Allowed group values [0-9][a-d], default depth set to 3. +# e.g. '0a' first, '0b' for second, '2a' for third and '9d' the last possible etc. +zi-turbo() { zi depth'3' lucid ${1/#[0-9][a-d]/wait"${1}"} "${@:2}"; } +# ]]] # Compatibility functions. [[[ zinit() { zi "$@"; } zpcdreplay() { .zi-compdef-replay -q; } From 94e189be841dd6cd0dd1a2c684a472de0af60f31 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 17:12:23 +0000 Subject: [PATCH 33/38] +col-dbg --- zi.zsh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/zi.zsh b/zi.zsh index 773ca5f4..b3be86e2 100755 --- a/zi.zsh +++ b/zi.zsh @@ -144,7 +144,7 @@ if [[ -z $SOURCED && ( ${+terminfo} -eq 1 && -n ${terminfo[colors]} ) || ( ${+te col-func $'\e[38;5;219m' col-nu $'\e[24m' col-var $'\e[38;5;81m' col-glob $'\e[38;5;227m' col-num $'\e[3;38;5;155m' col-version $'\e[3;38;5;46m' col-happy $'\e[1m\e[38;5;82m' col-obj $'\e[38;5;218m' col-warn $'\e[38;5;214m' - col-hi $'\e[1m\e[38;5;183m' col-obj2 $'\e[38;5;118m' + col-hi $'\e[1m\e[38;5;183m' col-obj2 $'\e[38;5;118m' col-dbg $'\e[90m' col-ice $'\e[38;5;39m' col-ok $'\e[38;5;220m' col-id-as $'\e[4;38;5;220m' col-opt $'\e[38;5;219m' col-mdsh "$'\e[1;38;5;220m'"${${${(M)LANG:#*UTF-8*}:+–}:--}"$'\e[0m'" @@ -2183,8 +2183,7 @@ env-whitelist|bindkeys|module|add-fpath|run${reply:+|${(~j:|:)"${reply[@]#z-anne local ___last_ice=${@[___retval2]} shift ___retval2 if [[ $# -gt 0 && $1 != for ]] { - +zi-message -n "{b}{u-warn}ERROR{b-warn}:{rst} Unknown subcommand{ehi}:" \ - "{apo}\`{cmd}$1{apo}\`{rst} " + +zi-message -n "{b}{u-warn}ERROR{b-warn}:{rst} Unknown subcommand{ehi}:" "{apo}\`{cmd}$1{apo}\`{rst} " +zi-prehelp-usage-message rst return 1 } elif (( $# == 0 )) { @@ -2266,8 +2265,7 @@ env-whitelist|bindkeys|module|add-fpath|run${reply:+|${(~j:|:)"${reply[@]#z-anne { [[ ${ZI[MUTE_WARNINGS]} != (1|true|on|yes) ]] && \ +zi-message "{u-warn}Warning{b-warn}:{msg} Bad new-ices returned" \ "from the annex{ehi}:{rst} {annex}${___arr[3]}{msg}," \ - "please file an issue report at:{url}" \ - "https://github.com/z-shell/${___arr[3]}/issues/new{msg}.{rst}" + "please file an issue report at:{url}" "https://github.com/z-shell/${___arr[3]}/issues/new{msg}.{rst}" ___ices=( ) ___retval+=7 } } From a46af43bc14497d3fea6ddfa5942a8c86dcd7f56 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 17:32:49 +0000 Subject: [PATCH 34/38] Update README.md --- docs/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/README.md b/docs/README.md index ee73ec88..b60ca708 100644 --- a/docs/README.md +++ b/docs/README.md @@ -46,6 +46,9 @@ Nightly Release --- +[![asciicast](https://asciinema.org/a/QcC3gmoOqIkMdPJ7J9v6hiWGf.svg)](https://asciinema.org/a/QcC3gmoOqIkMdPJ7J9v6hiWGf) + + ## Getting Started ### Prerequisites From 4b8af45c0263798cad980b319bb22218ad3be2d4 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 17:53:40 +0000 Subject: [PATCH 35/38] -whitespace --- .github/workflows/wiki.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/wiki.yml b/.github/workflows/wiki.yml index 0dca0204..976b1da7 100644 --- a/.github/workflows/wiki.yml +++ b/.github/workflows/wiki.yml @@ -2,27 +2,27 @@ name: 📖 Wiki CI on: push: - branches: wiki + branches: [ wiki ] paths: - - 'docs/wiki/**' + - "docs/wiki/**" workflow_dispatch: jobs: deploy-wiki: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: 🌟 Markdown lint - uses: nosborn/github-action-markdown-cli@master - with: - files: "docs/wiki/*.md" - config_file: "docs/lint/.markdownlint.json" + - uses: actions/checkout@v2 + - name: 🌟 Markdown lint + uses: nosborn/github-action-markdown-cli@master + with: + files: "docs/wiki/*.md" + config_file: "docs/lint/.markdownlint.json" - - name: 📩 Add to wiki - uses: Andrew-Chen-Wang/github-wiki-action@v2 - env: - WIKI_DIR: docs/wiki/ - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GH_MAIL: ${{ secrets.GH_MAIL }} - GH_NAME: ${{ github.repository_owner }} - EXCLUDED_FILES: "docs/wiki/drafts" + - name: 📩 Add to wiki + uses: Andrew-Chen-Wang/github-wiki-action@v2 + env: + WIKI_DIR: docs/wiki/ + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_MAIL: ${{ secrets.GH_MAIL }} + GH_NAME: ${{ github.repository_owner }} + EXCLUDED_FILES: "docs/wiki/drafts" From 825a7765d84d5fb5b1fa3ecd16f4d4f890882151 Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 18:02:28 +0000 Subject: [PATCH 36/38] Create rebase.md --- .github/workflows/rebase.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/rebase.md diff --git a/.github/workflows/rebase.md b/.github/workflows/rebase.md new file mode 100644 index 00000000..54c6ed10 --- /dev/null +++ b/.github/workflows/rebase.md @@ -0,0 +1,19 @@ +name: 🧬 Automatic Rebase +on: + issue_comment: + types: [created] +jobs: + rebase: + name: Rebase + if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') + runs-on: ubuntu-latest + steps: + - name: ☑️ Checkout the latest code + uses: actions/checkout@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 # otherwise, you will fail to push refs to dest repo + - name: 🧬 Automatic Rebase + uses: cirrus-actions/rebase@1.4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 2c4ba9721aac3a4b60a01222f8ba3cee5d066b1b Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 18:03:45 +0000 Subject: [PATCH 37/38] Rename rebase.md to rebase.yml --- .github/workflows/{rebase.md => rebase.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{rebase.md => rebase.yml} (100%) diff --git a/.github/workflows/rebase.md b/.github/workflows/rebase.yml similarity index 100% rename from .github/workflows/rebase.md rename to .github/workflows/rebase.yml From 70c804c5f3c08794406a722274f4f9dc0197e68a Mon Sep 17 00:00:00 2001 From: Salvydas Lukosius Date: Tue, 7 Dec 2021 18:06:08 +0000 Subject: [PATCH 38/38] +editorconfig | .yml 2 --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 6de79a47..68bec942 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,7 +13,7 @@ trim_trailing_whitespace = false [*.{yml,yaml}] indent_style = space -tab_width = 4 +tab_width = 2 [*.{sh,bash,zsh,fish}] indent_style = space