From d502f0e4a1635a174519f0d355fbdd756dd24e92 Mon Sep 17 00:00:00 2001 From: Andrea Mistrali Date: Fri, 24 Jan 2020 16:44:08 +0100 Subject: [PATCH] Changed zshrc --- antibody/zshrc.antibody | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/antibody/zshrc.antibody b/antibody/zshrc.antibody index 104e354..221411d 100644 --- a/antibody/zshrc.antibody +++ b/antibody/zshrc.antibody @@ -1,16 +1,36 @@ # Created by newuser for 5.7.1 # -ZSH="$(antibody home)/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh" -source ~/.zshdir/plugins.sh export DEFAULT_USER=$(whoami) # export WORKON_HOME=$HOME/Src/virtualenvs export PROJECT_HOME=$HOME/Src/projects +export SHOW_AWS_PROMPT=false + +ZSH="$(antibody home)/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh" +source ~/.zshdir/plugins.sh + prompt_dir() { prompt_segment blue black ' %3~' } + +#AWS Profile: +# - display current AWS_PROFILE name +# - displays yellow on red if profile name contains 'production' or +# ends in '-prod' +# - displays black on green otherwise +prompt_aws_profile() { + local aws_profile="$AWS_PROFILE" + if [[ -n $aws_profile ]]; then + if [[ $aws_profile == "prod"* || $aws_profile == "production"* ]]; then + prompt_segment green yellow " $aws_profile" + else + prompt_segment green black " $aws_profile" + fi + fi +} + prompt_context() { local user=`whoami` if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CONNECTION" ]] @@ -18,6 +38,17 @@ prompt_context() { prompt_segment $PRIMARY_FG default " %(!.%{%F{yellow}%}.)$user@%m " fi prompt_segment $PRIMARY_FG default "%{\e]2;%m:%.\a%}" + prompt_aws_profile +} + +build_prompt() { + RETVAL=$? + prompt_status + prompt_virtualenv + prompt_aws_profile + prompt_context + # prompt_dir + prompt_git } cd