Compare commits

...

5 Commits

Author SHA1 Message Date
Insik Lee 782e41759d
Merge f257e4fd23 into 9253fb1c50 2026-06-15 14:41:57 -07:00
Roman Perepelitsa 9253fb1c50 fix a bug that triggers when SH_GLOB is set (#2887) 2026-06-15 09:54:55 +02:00
Insik Lee f257e4fd23 chore: update p10k config setting with `zig_version`
Make sure each config option has `zig_version` commented out
ready to be used.
2024-12-31 01:09:47 -05:00
Insik Lee 2a96a782f2
Merge branch 'romkatv:master' into local 2024-12-31 00:32:37 -05:00
Insik Lee eba4003594 Add Zig version prompt element
Enable by adding `zig_version` to prompt element
2024-12-30 19:32:27 -05:00
7 changed files with 42 additions and 7 deletions

View File

@ -54,6 +54,7 @@
# node_version # node.js version # node_version # node.js version
# go_version # go version (https://golang.org) # go_version # go version (https://golang.org)
# rust_version # rustc version (https://www.rust-lang.org) # rust_version # rustc version (https://www.rust-lang.org)
# zig_version # zig version (https://ziglang.org/)
# dotnet_version # .NET version (https://dotnet.microsoft.com) # dotnet_version # .NET version (https://dotnet.microsoft.com)
# php_version # php version (https://www.php.net/) # php_version # php version (https://www.php.net/)
# laravel_version # laravel php framework version (https://laravel.com/) # laravel_version # laravel php framework version (https://laravel.com/)

View File

@ -54,6 +54,7 @@
# node_version # node.js version # node_version # node.js version
# go_version # go version (https://golang.org) # go_version # go version (https://golang.org)
# rust_version # rustc version (https://www.rust-lang.org) # rust_version # rustc version (https://www.rust-lang.org)
# zig_version # zig version (https://ziglang.org/)
# dotnet_version # .NET version (https://dotnet.microsoft.com) # dotnet_version # .NET version (https://dotnet.microsoft.com)
# php_version # php version (https://www.php.net/) # php_version # php version (https://www.php.net/)
# laravel_version # laravel php framework version (https://laravel.com/) # laravel_version # laravel php framework version (https://laravel.com/)

View File

@ -54,6 +54,7 @@
# node_version # node.js version # node_version # node.js version
# go_version # go version (https://golang.org) # go_version # go version (https://golang.org)
# rust_version # rustc version (https://www.rust-lang.org) # rust_version # rustc version (https://www.rust-lang.org)
# zig_version # zig version (https://ziglang.org/)
# dotnet_version # .NET version (https://dotnet.microsoft.com) # dotnet_version # .NET version (https://dotnet.microsoft.com)
# php_version # php version (https://www.php.net/) # php_version # php version (https://www.php.net/)
# laravel_version # laravel php framework version (https://laravel.com/) # laravel_version # laravel php framework version (https://laravel.com/)

View File

@ -54,6 +54,7 @@
# node_version # node.js version # node_version # node.js version
# go_version # go version (https://golang.org) # go_version # go version (https://golang.org)
# rust_version # rustc version (https://www.rust-lang.org) # rust_version # rustc version (https://www.rust-lang.org)
# zig_version # zig version (https://ziglang.org/)
# dotnet_version # .NET version (https://dotnet.microsoft.com) # dotnet_version # .NET version (https://dotnet.microsoft.com)
# php_version # php version (https://www.php.net/) # php_version # php version (https://www.php.net/)
# laravel_version # laravel php framework version (https://laravel.com/) # laravel_version # laravel php framework version (https://laravel.com/)

View File

@ -601,6 +601,7 @@ function _p9k_init_icons() {
SWIFT_ICON '\uE755' #  SWIFT_ICON '\uE755' # 
GO_ICON '\uE626' #  GO_ICON '\uE626' # 
GOLANG_ICON '\uE626' #  GOLANG_ICON '\uE626' # 
ZIG_ICON '\uE6A9' # 
PUBLIC_IP_ICON '\UF0AC'$s #  PUBLIC_IP_ICON '\UF0AC'$s # 
LOCK_ICON '\UF023' #  LOCK_ICON '\UF023' # 
NORDVPN_ICON '\UF023' #  NORDVPN_ICON '\UF023' # 

View File

@ -138,6 +138,14 @@ function getColorCode() {
return 1 return 1
} }
function _p9k_codeset_is_utf8() {
# Use `case` to survive SH_GLOB.
case "${langinfo[CODESET]}" in
utf-8|UTF-8|utf8|UTF8) return 0;;
*) return 1;;
esac
}
# _p9k_declare <type> <uppercase-name> [default]... # _p9k_declare <type> <uppercase-name> [default]...
function _p9k_declare() { function _p9k_declare() {
local -i set=$+parameters[$2] local -i set=$+parameters[$2]
@ -1796,7 +1804,7 @@ prompt_dir() {
if (( $+_POWERLEVEL9K_SHORTEN_DELIMITER )); then if (( $+_POWERLEVEL9K_SHORTEN_DELIMITER )); then
local delim=$_POWERLEVEL9K_SHORTEN_DELIMITER local delim=$_POWERLEVEL9K_SHORTEN_DELIMITER
else else
if [[ $langinfo[CODESET] == (utf|UTF)(-|)8 ]]; then if _p9k_codeset_is_utf8; then
local delim=$'\u2026' local delim=$'\u2026'
else else
local delim='..' local delim='..'
@ -2197,6 +2205,21 @@ _p9k_prompt_go_version_init() {
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[go]' typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[go]'
} }
################################################################
# Zig prompt
prompt_zig_version() {
_p9k_cached_cmd 0 '' zig version || return
local v=$_p9k__ret
if (( _POWERLEVEL9K_ZIG_VERSION_PROJECT_ONLY )); then
_p9k_upglob build.zig -. && return
fi
_p9k_prompt_segment "$0" "orange1" "black" "ZIG_ICON" 0 '' "${v//\%/%%}"
}
_p9k_prompt_zig_version_init() {
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[zig]'
}
################################################################ ################################################################
# Command number (in local history) # Command number (in local history)
prompt_history() { prompt_history() {
@ -6851,13 +6874,13 @@ function _p9k_restore_special_params() {
} }
function _p9k_on_expand() { function _p9k_on_expand() {
(( _p9k__expanded && ! ${+__p9k_instant_prompt_active} )) && [[ "${langinfo[CODESET]}" == (utf|UTF)(-|)8 ]] && return (( _p9k__expanded && ! ${+__p9k_instant_prompt_active} )) && _p9k_codeset_is_utf8 && return
eval "$__p9k_intro_no_locale" eval "$__p9k_intro_no_locale"
if [[ $langinfo[CODESET] != (utf|UTF)(-|)8 ]]; then if ! _p9k_codeset_is_utf8; then
_p9k_restore_special_params _p9k_restore_special_params
if [[ $langinfo[CODESET] != (utf|UTF)(-|)8 ]] && _p9k_init_locale; then if ! _p9k_codeset_is_utf8 && _p9k_init_locale; then
if [[ -n $LC_ALL ]]; then if [[ -n $LC_ALL ]]; then
_p9k__real_lc_all=$LC_ALL _p9k__real_lc_all=$LC_ALL
LC_ALL=$__p9k_locale LC_ALL=$__p9k_locale
@ -7458,7 +7481,7 @@ _p9k_init_params() {
_p9k_declare -i POWERLEVEL9K_VCS_SHORTEN_LENGTH _p9k_declare -i POWERLEVEL9K_VCS_SHORTEN_LENGTH
_p9k_declare -i POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH _p9k_declare -i POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH
_p9k_declare -s POWERLEVEL9K_VCS_SHORTEN_STRATEGY _p9k_declare -s POWERLEVEL9K_VCS_SHORTEN_STRATEGY
if [[ $langinfo[CODESET] == (utf|UTF)(-|)8 ]]; then if _p9k_codeset_is_utf8; then
_p9k_declare -e POWERLEVEL9K_VCS_SHORTEN_DELIMITER '\u2026' _p9k_declare -e POWERLEVEL9K_VCS_SHORTEN_DELIMITER '\u2026'
else else
_p9k_declare -e POWERLEVEL9K_VCS_SHORTEN_DELIMITER '..' _p9k_declare -e POWERLEVEL9K_VCS_SHORTEN_DELIMITER '..'
@ -7661,6 +7684,7 @@ _p9k_init_params() {
_p9k_declare -b POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY 1 _p9k_declare -b POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY 1
_p9k_declare -b POWERLEVEL9K_GO_VERSION_PROJECT_ONLY 1 _p9k_declare -b POWERLEVEL9K_GO_VERSION_PROJECT_ONLY 1
_p9k_declare -b POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY 1 _p9k_declare -b POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY 1
_p9k_declare -b POWERLEVEL9K_ZIG_VERSION_PROJECT_ONLY 1
_p9k_declare -b POWERLEVEL9K_PERLBREW_PROJECT_ONLY 1 _p9k_declare -b POWERLEVEL9K_PERLBREW_PROJECT_ONLY 1
_p9k_declare -b POWERLEVEL9K_PERLBREW_SHOW_PREFIX 0 _p9k_declare -b POWERLEVEL9K_PERLBREW_SHOW_PREFIX 0
_p9k_declare -b POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY 0 _p9k_declare -b POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY 0
@ -9519,7 +9543,7 @@ if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file && -n $__p9k_instant_p
zf_rm -f -- $__p9k_instant_prompt_dump_file{,.zwc} 2>/dev/null zf_rm -f -- $__p9k_instant_prompt_dump_file{,.zwc} 2>/dev/null
fi fi
typeset -g P9K_VERSION=1.20.16 typeset -g P9K_VERSION=1.20.17
if [[ ${VSCODE_SHELL_INTEGRATION-} == <1-> && ${+__p9k_force_term_shell_integration} == 0 ]]; then if [[ ${VSCODE_SHELL_INTEGRATION-} == <1-> && ${+__p9k_force_term_shell_integration} == 0 ]]; then
typeset -gri __p9k_force_term_shell_integration=1 typeset -gri __p9k_force_term_shell_integration=1

View File

@ -27,7 +27,13 @@
local -a match mbegin mend local -a match mbegin mend
local -i MBEGIN MEND OPTIND local -i MBEGIN MEND OPTIND
local MATCH OPTARG IFS=$'\'' \t\n\0'\' local MATCH OPTARG IFS=$'\'' \t\n\0'\'
typeset -gr __p9k_intro_locale='[[ $langinfo[CODESET] != (utf|UTF)(-|)8 ]] && _p9k_init_locale && { [[ -n $LC_ALL ]] && local LC_ALL=$__p9k_locale || local LC_CTYPE=$__p9k_locale }' # Use `case` to survive SH_GLOB.
typeset -gr __p9k_intro_locale='{
case "${langinfo[CODESET]}" in
utf-8|UTF-8|utf8|UTF8) false;;
*) true;;
esac
} && _p9k_init_locale && { [[ -n "$LC_ALL" ]] && local LC_ALL=$__p9k_locale || local LC_CTYPE=$__p9k_locale }'
typeset -gr __p9k_intro_no_locale="${${__p9k_intro_base/ match / match reply }/ MATCH / MATCH REPLY }" typeset -gr __p9k_intro_no_locale="${${__p9k_intro_base/ match / match reply }/ MATCH / MATCH REPLY }"
typeset -gr __p9k_intro_no_reply="$__p9k_intro_base; $__p9k_intro_locale" typeset -gr __p9k_intro_no_reply="$__p9k_intro_base; $__p9k_intro_locale"
typeset -gr __p9k_intro="$__p9k_intro_no_locale; $__p9k_intro_locale" typeset -gr __p9k_intro="$__p9k_intro_no_locale; $__p9k_intro_locale"