From a761e3c28a78cfbf7d7ca9cde5bdcd1126c2996c Mon Sep 17 00:00:00 2001 From: Conrad Haupt Date: Mon, 12 Mar 2018 14:28:17 +0200 Subject: [PATCH 01/10] Fixed home abbreviation not being exclusive with circular navigation --- powerlevel9k.zsh-theme | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 14d7bd81..12d05db3 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -809,7 +809,9 @@ prompt_dir() { current_path="${cur_short_path: : -1}" ;; *) - current_path="$(print -P "%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:$POWERLEVEL9K_SHORTEN_DELIMITER/:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c")" + if [[ $current_path != "~" ]]; then + current_path="$(print -P "%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:$POWERLEVEL9K_SHORTEN_DELIMITER/:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c")" + fi ;; esac fi From 83ad5b598e1524fa76055f8ed086eb155c39c580 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 20 Mar 2018 22:39:20 +0100 Subject: [PATCH 02/10] Add test for wrong truncation if switching back to home folder This happens if a user switches from a subdirectory of $HOME back to the home folder and truncation strategy is "truncate folders from left". Then the folder is displayed as .../~ PR: #773 --- test/segments/dir.spec | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/segments/dir.spec b/test/segments/dir.spec index ef27e160..97bc857c 100755 --- a/test/segments/dir.spec +++ b/test/segments/dir.spec @@ -36,6 +36,27 @@ function testTruncateFoldersWorks() { unset POWERLEVEL9K_SHORTEN_STRATEGY } +function testTruncateFolderWithHomeDirWorks() { + POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 + CURRENT_DIR=$(pwd) + + cd ~ + FOLDER="powerlevel9k-test-${RANDOM}" + mkdir -p $FOLDER + cd $FOLDER + # Switch back to home folder as this causes the problem. + cd .. + + assertEquals "%K{blue} %F{black}~ %k%F{blue}%f " "$(build_left_prompt)" + + rmdir $FOLDER + cd ${CURRENT_DIR} + + unset CURRENT_DIR + unset FOLDER + unset POWERLEVEL9K_SHORTEN_DIR_LENGTH +} + function testTruncateMiddleWorks() { POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle' From 70fa74f6313bf6a6df3c71e1c82783f6af46c7a0 Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Wed, 21 Mar 2018 16:28:23 +0100 Subject: [PATCH 03/10] Fix Brightness Table --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 46d8ab61..cb5c065c 100644 --- a/README.md +++ b/README.md @@ -250,10 +250,12 @@ As with the battery stages, you can use any number of colors and Powerlevel9k will automatically use all of them appropriately. Some example settings: -|Brightness|Possible Array| -|Bright Colors|(196 202 208 214 220 226 190 154 118 82 46)| -|Normal Colors|(124 130 136 142 148 112 76 40 34 28 22)| -|Subdued Colors|( 88 94 100 106 70 34 28 22)| + +| Brightness | Possible Array | +|----------------|-------------------------------------------------| +| Bright Colors | `(196 202 208 214 220 226 190 154 118 82 46)` | +| Normal Colors | `(124 130 136 142 148 112 76 40 34 28 22)` | +| Subdued Colors | `( 88 94 100 106 70 34 28 22)` | ##### command_execution_time From 4de4e8d9d70ba3faeea31c2486632b5cb142b40d Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Thu, 22 Mar 2018 01:05:35 +0100 Subject: [PATCH 04/10] Fix POWERLEVEL9k_BATTERY_STAGES Table --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cb5c065c..9991547a 100644 --- a/README.md +++ b/README.md @@ -209,8 +209,9 @@ You can also change the battery icon automatically depending on the battery level. This will override the default battery icon. In order to do this, you need to define the `POWERLEVEL9k_BATTERY_STAGES` variable. -| Variable | Default Value | Description | -| `POWERLEVEL9K_BATTERY_STAGES`|Unset|A string or array, which each index indicates a charge level.| +| Variable | Default Value | Description | +|-------------------------------|---------------|---------------------------------------------------------------| +| `POWERLEVEL9K_BATTERY_STAGES` | Unset | A string or array, which each index indicates a charge level. | Powerlevel9k will use each index of the string or array as a stage to indicate battery charge level, progressing from left to right. You can provide any number of From fe33c401bac783181e0fc53401685fa9b2ad0e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Mon, 26 Mar 2018 14:55:06 -0400 Subject: [PATCH 05/10] workaround for ZSH status behavior `$pipestatus` is returning all zeros when using `[[ ]]` expressions that are false. This works around it by using `$status` (A.K.A. `$?`) when `$pipestatus` has only 1 items. Fixes #749 --- powerlevel9k.zsh-theme | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 14d7bd81..2255a04a 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1163,8 +1163,13 @@ prompt_status() { local ec if [[ $POWERLEVEL9K_STATUS_SHOW_PIPESTATUS == true ]]; then - ec_text=$(exit_code_or_status "${RETVALS[1]}") - ec_sum=${RETVALS[1]} + if (( $#RETVALS > 1 )); then + ec_text=$(exit_code_or_status "${RETVALS[1]}") + ec_sum=${RETVALS[1]} + else + ec_text=$(exit_code_or_status "${RETVAL}") + ec_sum=${RETVAL} + fi for ec in "${(@)RETVALS[2,-1]}"; do ec_text="${ec_text}|$(exit_code_or_status "$ec")" From 9f7b0b7404a3d5307755d5e55ddc33e2e39090ba Mon Sep 17 00:00:00 2001 From: Ryan Davidson Date: Tue, 3 Apr 2018 13:52:13 +0100 Subject: [PATCH 06/10] #777 Add POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW variable to display prompt_rbenv if rbenv_version_name is the same as rbenv_global --- powerlevel9k.zsh-theme | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 14d7bd81..07902ba6 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1065,14 +1065,15 @@ prompt_ram() { "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "$(printSizeHumanReadable "$ramfree" $base)" 'RAM_ICON' } +set_default POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW false # rbenv information prompt_rbenv() { - if which rbenv 2>/dev/null >&2; then + if command which rbenv 2>/dev/null >&2; then local rbenv_version_name="$(rbenv version-name)" local rbenv_global="$(rbenv global)" # Don't show anything if the current Ruby is the same as the global Ruby. - if [[ $rbenv_version_name == $rbenv_global ]]; then + if [[ $rbenv_version_name == $rbenv_global && "$POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW" = false ]]; then return fi @@ -1418,7 +1419,7 @@ prompt_kubecontext() { if [[ -z "$k8s_namespace" ]]; then k8s_namespace="default" fi - + local k8s_final_text="" if [[ "$k8s_context" == "k8s_namespace" ]]; then @@ -1427,8 +1428,8 @@ prompt_kubecontext() { else k8s_final_text="$k8s_context/$k8s_namespace" fi - - + + "$1_prompt_segment" "$0" "$2" "magenta" "white" "$k8s_final_text" "KUBERNETES_ICON" fi } From e85fb6c93d6bc77d827133a3419d888fed5c8a4d Mon Sep 17 00:00:00 2001 From: Ryan Davidson Date: Tue, 3 Apr 2018 14:04:28 +0100 Subject: [PATCH 07/10] #777 update Readme with POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW variable description --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 46d8ab61..a04b4eea 100644 --- a/README.md +++ b/README.md @@ -511,6 +511,10 @@ It figures out the version being used by taking the output of the `rbenv version * If `rbenv` is not in $PATH, nothing will be shown. * If the current Ruby version is the same as the global Ruby version, nothing will be shown. +| Variable | Default Value | Description | +|----------|---------------|-------------| +|`POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW`|`false`|Set to true if you wish to show the rbenv segment even if the current Ruby version is the same as the global Ruby version| + ##### rspec_stats See [Unit Test Ratios](#unit-test-ratios), below. From 2eddce2f62ec848fb8063390e7382d7d7e07a22f Mon Sep 17 00:00:00 2001 From: Alexandre ZANNI <16578570+noraj@users.noreply.github.com> Date: Thu, 12 Apr 2018 22:54:34 +0200 Subject: [PATCH 08/10] add rvm see those files and look for `rvm` + https://github.com/bhilburn/powerlevel9k/blob/master/CHANGELOG.md + https://github.com/bhilburn/powerlevel9k/blob/master/powerlevel9k.zsh-theme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 46d8ab61..5a8ae852 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ The segments that are currently available are: * [`chruby`](#chruby) - Ruby environment information using `chruby` (if one is active). * [`rbenv`](#rbenv) - Ruby environment information using `rbenv` (if one is active). * [`rspec_stats`](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. + * `rvm` - Ruby environment information using `$GEM_HOME` and `$MY_RUBY_HOME` (if one is active). * **Rust Segments:** * `rust_version` - Display the current rust version and [logo](https://www.rust-lang.org/logos/rust-logo-blk.svg). * **Swift Segments:** From 02d4e76eb4e7864a9f5ee326b6971a8407c93c4e Mon Sep 17 00:00:00 2001 From: lifehackett Date: Fri, 13 Apr 2018 08:07:43 -0600 Subject: [PATCH 09/10] Fix table formatting in README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 46d8ab61..43e9cb68 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,7 @@ level. This will override the default battery icon. In order to do this, you need to define the `POWERLEVEL9k_BATTERY_STAGES` variable. | Variable | Default Value | Description | +|----------|---------------|-------------| | `POWERLEVEL9K_BATTERY_STAGES`|Unset|A string or array, which each index indicates a charge level.| Powerlevel9k will use each index of the string or array as a stage to indicate battery From cfda084eb80b76471f1b0fff5eb1332be153974f Mon Sep 17 00:00:00 2001 From: lifehackett Date: Fri, 13 Apr 2018 08:13:15 -0600 Subject: [PATCH 10/10] Another table formatting fix --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 43e9cb68..f7bab697 100644 --- a/README.md +++ b/README.md @@ -251,7 +251,9 @@ As with the battery stages, you can use any number of colors and Powerlevel9k will automatically use all of them appropriately. Some example settings: + |Brightness|Possible Array| +|----------|--------------| |Bright Colors|(196 202 208 214 220 226 190 154 118 82 46)| |Normal Colors|(124 130 136 142 148 112 76 40 34 28 22)| |Subdued Colors|( 88 94 100 106 70 34 28 22)|