From 1ab87862ffb637692229cb7f7cf2810a3b3d72cc Mon Sep 17 00:00:00 2001 From: apodkutin Date: Sun, 28 Oct 2018 00:36:31 +0200 Subject: [PATCH 1/2] [Agnoster theme] Add the prompt view customization ability --- themes/agnoster.zsh-theme | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 518a14a37..fb3c58198 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -29,6 +29,20 @@ # jobs are running in this shell will all be displayed automatically when # appropriate. +### Segments of the prompt default order declaration + +typeset -aHg AGNOSTER_PROMPT=( + prompt_status + prompt_virtualenv + prompt_aws + prompt_context + prompt_dir + prompt_git + prompt_bzr + prompt_hg + prompt_end +) + ### Segment drawing # A few utility functions to make it easy and re-usable to draw segmented prompts @@ -239,15 +253,9 @@ prompt_aws() { ## Main prompt build_prompt() { RETVAL=$? - prompt_status - prompt_virtualenv - prompt_aws - prompt_context - prompt_dir - prompt_git - prompt_bzr - prompt_hg - prompt_end + for prompt_segment in "${AGNOSTER_PROMPT[@]}"; do + [[ -n $prompt_segment ]] && $prompt_segment + done } PROMPT='%{%f%b%k%}$(build_prompt) ' From 8b9ab37042cc3f562683ab865287b5cf1fd95770 Mon Sep 17 00:00:00 2001 From: apodkutin Date: Wed, 31 Oct 2018 20:12:57 +0100 Subject: [PATCH 2/2] [Agnoster theme] Rename AGNOSTER_PROMPT to AGNOSTER_PROMPT_SEGMENTS --- themes/agnoster.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index fb3c58198..993fd6e3d 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -31,7 +31,7 @@ ### Segments of the prompt default order declaration -typeset -aHg AGNOSTER_PROMPT=( +typeset -aHg AGNOSTER_PROMPT_SEGMENTS=( prompt_status prompt_virtualenv prompt_aws @@ -253,7 +253,7 @@ prompt_aws() { ## Main prompt build_prompt() { RETVAL=$? - for prompt_segment in "${AGNOSTER_PROMPT[@]}"; do + for prompt_segment in "${AGNOSTER_PROMPT_SEGMENTS[@]}"; do [[ -n $prompt_segment ]] && $prompt_segment done }