@@ -61,48 +61,50 @@ tw_get_virtual_env() {
61
61
fi ;
62
62
}
63
63
64
- tw_get_home_relative_wd () {
65
- echo " %F{$tw_current_directory_color }%~"
66
- }
64
+ tw_get_displayed_wd () {
65
+ local tw_git_branch=$tw_prompt_data [tw_git_branch]
66
+ local tw_git_home=$tw_prompt_data [tw_git_home]
67
+
68
+ local tw_home_relative_wd=" %~"
69
+ local tw_git_relative_wd=" $tw_git_home %c"
67
70
68
- tw_get_git_relative_wd () {
69
- local tw_home_relative_wd=" $1 "
70
- local tw_git_branch=" $2 "
71
- local tw_git_home=" $3 "
71
+ local tw_displayed_wd=" $tw_git_relative_wd "
72
72
73
- local tw_git_relative_wd=" %F{$tw_current_directory_color }$tw_git_home %c"
73
+ # The pure layout defaults to home relative working directory, but allows customization
74
+ if [[ " $TYPEWRITTEN_PROMPT_LAYOUT " = " pure" && " $TYPEWRITTEN_RELATIVE_PATH " = " " ]]; then
75
+ tw_displayed_wd=$tw_home_relative_wd
76
+ fi ;
74
77
75
78
if [[ " $TYPEWRITTEN_RELATIVE_PATH " = " home" ]]; then
76
- tw_git_relative_wd =$tw_home_relative_wd
79
+ tw_displayed_wd =$tw_home_relative_wd
77
80
fi ;
78
81
79
82
if [[ " $TYPEWRITTEN_RELATIVE_PATH " = " adaptive" ]]; then
80
83
if [[ " $tw_git_branch " = " " ]]; then
81
- tw_git_relative_wd =$tw_home_relative_wd
84
+ tw_displayed_wd =$tw_home_relative_wd
82
85
fi ;
83
86
fi ;
84
87
85
- echo $tw_git_relative_wd
88
+ echo " %F{ $tw_current_directory_color } $tw_displayed_wd "
86
89
}
87
90
88
91
tw_redraw () {
89
- tw_home_relative_wd=" $( tw_get_home_relative_wd) "
90
- tw_git_relative_wd=" $( tw_get_git_relative_wd $tw_home_relative_wd $tw_prompt_data [tw_git_branch] $tw_prompt_data [tw_git_home]) "
92
+ tw_displayed_wd=" $( tw_get_displayed_wd) "
91
93
92
94
tw_env_prompt=" $( tw_get_virtual_env) $tw_prompt "
93
95
94
96
tw_layout=" $TYPEWRITTEN_PROMPT_LAYOUT "
95
97
tw_git_info=" $tw_prompt_data [tw_git_branch]$tw_prompt_data [tw_git_status]"
96
98
if [ " $tw_layout " = " half_pure" ]; then
97
99
PROMPT=" $BREAK_LINE %F{$tw_git_branch_color }$tw_git_info$BREAK_LINE$tw_env_prompt "
98
- RPROMPT=" $tw_right_prompt_prefix$tw_git_relative_wd "
100
+ RPROMPT=" $tw_right_prompt_prefix$tw_displayed_wd "
99
101
else
100
102
local tw_git_arrow_info=" "
101
103
if [ " $tw_git_info " != " " ]; then
102
104
tw_git_arrow_info=" $tw_arrow %F{$tw_git_branch_color }$tw_git_info "
103
105
fi ;
104
106
if [ " $tw_layout " = " pure" ]; then
105
- PROMPT=" $BREAK_LINE$tw_home_relative_wd $tw_git_arrow_info$BREAK_LINE$tw_env_prompt "
107
+ PROMPT=" $BREAK_LINE$tw_displayed_wd $tw_git_arrow_info$BREAK_LINE$tw_env_prompt "
106
108
RPROMPT=" "
107
109
else
108
110
if [ " $tw_layout " = " singleline_verbose" ]; then
@@ -112,7 +114,7 @@ tw_redraw() {
112
114
else
113
115
PROMPT=" $tw_env_prompt "
114
116
fi ;
115
- RPROMPT=" $tw_right_prompt_prefix$tw_git_relative_wd $tw_git_arrow_info "
117
+ RPROMPT=" $tw_right_prompt_prefix$tw_displayed_wd $tw_git_arrow_info "
116
118
fi ;
117
119
fi ;
118
120
0 commit comments