From 413d7a1326721ce803240fc5af299329e2afee3c Mon Sep 17 00:00:00 2001 From: zou000 Date: Sat, 16 Oct 2021 19:15:00 -0700 Subject: [PATCH 1/3] Fix home dir substitution See the discussions in https://github.com/Bash-it/bash-it/commit/953e422bed2f9b0ba01ec998fe619e523819551f#commitcomment-58148656 . Tested with bash 5.1 and bash 3.2 --- themes/powerline/powerline.base.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index cffaa98d99..db770404aa 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -142,7 +142,7 @@ function __powerline_scm_prompt() { } function __powerline_cwd_prompt() { - local cwd="${PWD/$HOME/~}" + local cwd=${PWD/$HOME/\~} echo "${cwd}|${CWD_THEME_PROMPT_COLOR}" } From bb3a51f742b610b4ffe1a2fb020b2de3504df17b Mon Sep 17 00:00:00 2001 From: zou000 Date: Sat, 16 Oct 2021 20:24:07 -0700 Subject: [PATCH 2/3] Update powerline.base.bash --- themes/powerline/powerline.base.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index db770404aa..3a44307dc4 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -142,7 +142,8 @@ function __powerline_scm_prompt() { } function __powerline_cwd_prompt() { - local cwd=${PWD/$HOME/\~} + # For maximum backwards compatibility: no outer quotes, escape ~ + local cwd=${PWD/#$HOME/\~} echo "${cwd}|${CWD_THEME_PROMPT_COLOR}" } From 7911f770cf9d7d9ca554251b2516497f08571303 Mon Sep 17 00:00:00 2001 From: zou000 Date: Sat, 16 Oct 2021 22:29:25 -0700 Subject: [PATCH 3/3] use `\w` --- themes/powerline/powerline.base.bash | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 3a44307dc4..5e07d36d37 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -142,10 +142,7 @@ function __powerline_scm_prompt() { } function __powerline_cwd_prompt() { - # For maximum backwards compatibility: no outer quotes, escape ~ - local cwd=${PWD/#$HOME/\~} - - echo "${cwd}|${CWD_THEME_PROMPT_COLOR}" + echo "\w|${CWD_THEME_PROMPT_COLOR}" } function __powerline_hostname_prompt() {