From 974a12e83ad4a6bff3d38e75acc097adde099105 Mon Sep 17 00:00:00 2001 From: Albin Kauffmann Date: Fri, 30 Jun 2023 10:11:30 +0200 Subject: [PATCH] feat(scw): display the current profile in the prompt --- plugins/scw/scw.plugin.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/scw/scw.plugin.zsh b/plugins/scw/scw.plugin.zsh index 088842324..3edea2b12 100644 --- a/plugins/scw/scw.plugin.zsh +++ b/plugins/scw/scw.plugin.zsh @@ -51,6 +51,20 @@ function _scw_profiles() { } compctl -K _scw_profiles ssp +function scw_prompt_info() { + local _scw_to_show + + if [[ -n "$SCW_PROFILE" ]]; then + _scw_to_show+="${ZSH_THEME_SCW_PROFILE_PREFIX=""}" + fi + + echo "$_scw_to_show" +} + +if [[ "$SHOW_SCW_PROMPT" != false && "$RPROMPT" != *'$(scw_prompt_info)'* ]]; then + RPROMPT='$(scw_prompt_info)'"$RPROMPT" +fi + # Load scw autocompletion if autocompletion not already loaded if ! command -v _scw &> /dev/null; then eval "$(scw autocomplete script shell=zsh)"