From f265cb5630a7541ea7e2bedf4f3251fa1f8eaf95 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 29 Aug 2025 17:28:53 +0200 Subject: [PATCH] Fix kgy --- modules/cli/zsh/init.zsh | 2 +- modules/cli/zsh/prompt.zsh | 48 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 modules/cli/zsh/prompt.zsh diff --git a/modules/cli/zsh/init.zsh b/modules/cli/zsh/init.zsh index 18f324f..1c251bb 100644 --- a/modules/cli/zsh/init.zsh +++ b/modules/cli/zsh/init.zsh @@ -95,7 +95,7 @@ yq() { } kgy() { - if [[ $1 == "secret" ]]; then + if [[ $1 == "secret" ]] || [[ $1 == "secrets" ]]; then kubectl get -o yaml "$@" | yq '.stringData = (.data | with_entries(.value |= @base64d))' else # we use yq instead of kubecolor to have the same color schema as above diff --git a/modules/cli/zsh/prompt.zsh b/modules/cli/zsh/prompt.zsh new file mode 100644 index 0000000..c453de3 --- /dev/null +++ b/modules/cli/zsh/prompt.zsh @@ -0,0 +1,48 @@ +setopt promptsubst + +# (){ +# local left right invisible leftcontent +# +# # User name. +# left+='%B%F{black}%K{green} %n ' +# # Current working directory. +# left+='%K{yellow} %~ ' +# +# # Version control branch. +# right='${vcs_info_msg_0_:+${vcs_info_msg_0_//[%]/%%} }' +# # Virtualenv. +# export VIRTUAL_ENV_DISABLE_PROMP=1 +# right+='${VIRTUAL_ENV:+venv }' +# +# # Editing mode. $ZLE_MODE shouldn't contain %, no need to escape +# ZLE_MODE=insert +# right+='%K{green} $ZLE_MODE' +# +# # closing +# right+=$' %k%f%b' +# +# # Combine left and right prompt with spacing in between. +# invisible='%([BSUbfksu]|([FBK]|){*})' +# +# leftcontent=${(S)left//$~invisible} +# rightcontent=${(S)right//$~invisible} +# +# PS1="$left\${(l,COLUMNS-\${#\${(%):-$leftcontent$rightcontent}},)}$right%{"$'\n%}$ ' +# } + +WORKDIR='%B%F{blue}%~%b%f' + +autoload -Uz vcs_info +zstyle ':vcs_info:*' enable git +zstyle ':vcs_info:git*' formats '(%b)' +precmd() { + vcs_info +} +GIT='%F{green}$vcs_info_msg_0_%f' + +PROMPT_SHLVL='%(?.%F{green}.%F{red})$(printf "❯%.0s" {1..$SHLVL})%f' + +# %(?.%F{green}>.$F{red}>.) + +export PROMPT="-----\n$WORKDIR $GIT $PROMPT_SHLVL " +export RPROMPT='%j'