From 9b7fffe1a8d213c8de734836c5bcd5d5c5ad0a4c Mon Sep 17 00:00:00 2001 From: Arav Singhal Date: Fri, 30 Sep 2016 21:32:22 +0530 Subject: [PATCH 1/3] Make status prompt show OK in non-verbose mode * The status prompt now shows the OK icon even in non-verbose mode. A toggle may be added to this effect in the future. --- powerlevel9k.zsh-theme | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 0860cff4..08100a41 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -740,16 +740,14 @@ prompt_rvm() { # Status: return code if verbose, otherwise just an icon if an error occurred set_default POWERLEVEL9K_STATUS_VERBOSE true prompt_status() { - if [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true ]]; then - if [[ "$RETVAL" -ne 0 ]]; then + if [[ "$RETVAL" -ne 0 ]]; then + if [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true ]]; then "$1_prompt_segment" "$0_ERROR" "$2" "red" "226" "$RETVAL" 'CARRIAGE_RETURN_ICON' else - "$1_prompt_segment" "$0_OK" "$2" "$DEFAULT_COLOR" "046" "" 'OK_ICON' - fi - else - if [[ "$RETVAL" -ne 0 ]]; then "$1_prompt_segment" "$0_ERROR" "$2" "$DEFAULT_COLOR" "red" "" 'FAIL_ICON' fi + else + "$1_prompt_segment" "$0_OK" "$2" "$DEFAULT_COLOR" "046" "" 'OK_ICON' fi } @@ -1082,4 +1080,3 @@ powerlevel9k_init() { } powerlevel9k_init "$@" - From cde591ce2e8034a181a2321365ee662f54dc2d63 Mon Sep 17 00:00:00 2001 From: Arav Singhal Date: Thu, 27 Oct 2016 11:42:21 +0530 Subject: [PATCH 2/3] Add toggle for showing OK in non verbose status Adds the toggle POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE for more customizability. If POWERLEVEL9K_STATUS_VERBOSE is false and POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE is true, the status prompt will show the OK visual identifier like in verbose mode. The prompt will show the OK identifier even if POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE is false in verbose mode. --- powerlevel9k.zsh-theme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 08100a41..eae2cd73 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -739,6 +739,7 @@ prompt_rvm() { # Status: return code if verbose, otherwise just an icon if an error occurred set_default POWERLEVEL9K_STATUS_VERBOSE true +set_default POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE false prompt_status() { if [[ "$RETVAL" -ne 0 ]]; then if [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true ]]; then @@ -746,7 +747,7 @@ prompt_status() { else "$1_prompt_segment" "$0_ERROR" "$2" "$DEFAULT_COLOR" "red" "" 'FAIL_ICON' fi - else + elif [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true || "$POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE" == true ]]; then "$1_prompt_segment" "$0_OK" "$2" "$DEFAULT_COLOR" "046" "" 'OK_ICON' fi } From b129cd09e00202a7f3c1d43e3e60a9e2da1e076c Mon Sep 17 00:00:00 2001 From: Arav Singhal Date: Thu, 27 Oct 2016 12:11:33 +0530 Subject: [PATCH 3/3] Describe OK in non-verbose toggle in README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d031706..8cdf7be2 100644 --- a/README.md +++ b/README.md @@ -317,7 +317,8 @@ This segment shows the return code of the last command. | Variable | Default Value | Description | |----------|---------------|-------------| -|`POWERLEVEL9K_STATUS_VERBOSE`|`true`|Set to false if you wish to hide this segment when the last command completed successfully.| +|`POWERLEVEL9K_STATUS_VERBOSE`|`true`|Set to false if you wish to not show the error code when the last command returned an error and optionally hide this segment when the last command completed successfully by setting `POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE` to false.| +|`POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE`|`false`|Set to true if you wish to show this segment when the last command completed successfully in non-verbose mode.| ##### ram