3a6fa9149b7a3db89d22f40ae371ad636f5ed527

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Fix tilde substitution in theme prompts

These themes used an adhoc substitution of $HOME for tilde
in $PWD, but it's better to use '%~' and is less error prone.

See #7160

Diff

 1diff --git a/themes/amuse.zsh-theme b/themes/amuse.zsh-theme
 2index 4e7361cedde50ff85aab845921f494c96703445b..d3f15ace5329de6888ac4c5dd1dc08e1a1e6a839 100644
 3--- a/themes/amuse.zsh-theme
 4+++ b/themes/amuse.zsh-theme
 5@@ -9,7 +9,7 @@ rbenv_version() {
 6 }
 7 
 8 PROMPT='
 9-%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%}
10+%{$fg_bold[green]%}%~%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%}
11 $ '
12 
13 # Must use Powerline font, for \uE0A0 to render.
14diff --git a/themes/candy-kingdom.zsh-theme b/themes/candy-kingdom.zsh-theme
15index 9d2103926880d318d12323f26c13eda6d003a545..30ce785c00dcc0f65722dabac5b71afbbee5ae06 100644
16--- a/themes/candy-kingdom.zsh-theme
17+++ b/themes/candy-kingdom.zsh-theme
18@@ -17,7 +17,7 @@ function box_name {
19 }
20 
21 PROMPT='
22-%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}$(box_name)%{$reset_color%}:%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
23+%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}$(box_name)%{$reset_color%}:%{$fg_bold[green]%}%~%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
24 %(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )$ '
25 
26 ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[magenta]%}branch: "
27diff --git a/themes/dstufft.zsh-theme b/themes/dstufft.zsh-theme
28index 5a23fcea5d071de16b1685d3e35d059eb2492c31..39ce69819fd087350652f354909864edfea9c91b 100644
29--- a/themes/dstufft.zsh-theme
30+++ b/themes/dstufft.zsh-theme
31@@ -9,7 +9,7 @@ function virtualenv_info {
32 }
33 
34 PROMPT='
35-%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info)
36+%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}%~%{$reset_color%}$(git_prompt_info)
37 $(virtualenv_info)$(prompt_char) '
38 
39 ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
40diff --git a/themes/fino-time.zsh-theme b/themes/fino-time.zsh-theme
41index c1a48d02a7b0a62aee9759eb20da70de033fec11..9caebc69ebac80eb5fab42f97ccc33e0a60e68cd 100644
42--- a/themes/fino-time.zsh-theme
43+++ b/themes/fino-time.zsh-theme
44@@ -30,11 +30,10 @@ if type rvm-prompt &>/dev/null; then
45     rvm_ruby='using%{$FG[243]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
46 fi
47 
48-local current_dir='${PWD/#$HOME/~}'
49 local git_info='$(git_prompt_info)'
50 
51 
52-PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}${rvm_ruby} %D - %*
53+PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}%~%{$reset_color%}${git_info} %{$FG[239]%}${rvm_ruby} %D - %*
54 ╰─$(virtualenv_info)$(prompt_char) "
55 
56 ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
57diff --git a/themes/fino.zsh-theme b/themes/fino.zsh-theme
58index 71ed6bbbc86e059bcd0f572c3692344d145b0672..28d6cc2ec541acd5c9e848f1d42aa4bb811ad836 100644
59--- a/themes/fino.zsh-theme
60+++ b/themes/fino.zsh-theme
61@@ -29,12 +29,11 @@ else
62   fi
63 fi
64 
65-local current_dir='${PWD/#$HOME/~}'
66 local git_info='$(git_prompt_info)'
67 local prompt_char='$(prompt_char)'
68 
69 
70-PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}${ruby_env}
71+PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}%~%{$reset_color%}${git_info} %{$FG[239]%}${ruby_env}
72 ╰─${prompt_char}%{$reset_color%} "
73 
74 ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"