From 60134cdcd7598277bd6573b80722a5c3769cc1b8 Mon Sep 17 00:00:00 2001 From: Andrea Mistrali Date: Tue, 11 Feb 2020 12:15:56 +0100 Subject: [PATCH] Added support for AWS profile to pure prompt --- .gitignore | 2 ++ zsh.d/prompts/pure/pure.zsh | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 1f02774..a082fc9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ zsh.d/99-local.zsh zsh.d/Darwin/99-local.zsh +*~ +*.swp diff --git a/zsh.d/prompts/pure/pure.zsh b/zsh.d/prompts/pure/pure.zsh index 2d3e0f1..5897cee 100644 --- a/zsh.d/prompts/pure/pure.zsh +++ b/zsh.d/prompts/pure/pure.zsh @@ -213,6 +213,11 @@ prompt_pure_precmd() { export VIRTUAL_ENV_DISABLE_PROMPT=12 fi + psvar[13]= + if [[ -n $AWS_PROFILE ]]; then + psvar[13]="|${AWS_PROFILE}|" + fi + # Make sure VIM prompt is reset. prompt_pure_reset_prompt_symbol @@ -733,6 +738,7 @@ prompt_pure_setup() { user 242 user:root default virtualenv 242 + aws blue ) prompt_pure_colors=("${(@kv)prompt_pure_colors_default}") @@ -751,6 +757,7 @@ prompt_pure_setup() { # If a virtualenv is activated, display it in grey. PROMPT='%(12V.%F{$prompt_pure_colors[virtualenv]}%12v%f .)' + PROMPT+='%(13V.%F{$prompt_pure_colors[aws]}%13v%f .)' # Prompt turns red if the previous command didn't exit with 0. local prompt_indicator='%(?.%F{$prompt_pure_colors[prompt:success]}.%F{$prompt_pure_colors[prompt:error]})${prompt_pure_state[prompt]}%f '