From 934e09ab000453bbcf05a3829a94d3fc7d5c366f Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Thu, 14 Mar 2024 12:53:51 -0400 Subject: [PATCH] Dirstack support in prompt. --- tcshrc.prompt.colors | 3 +++ tcshrc.prompt.final | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tcshrc.prompt.colors b/tcshrc.prompt.colors index 0ef8724..8ff51d4 100644 --- a/tcshrc.prompt.colors +++ b/tcshrc.prompt.colors @@ -17,6 +17,9 @@ set line_color="ansi:1" set prompt_color="reset" set depth_color="ansi:3" set percent_color="ansi:6" + +set dirs_color="ansi:12 italic" + #${csi}3;4;38;2;255;192;192;58;2;255;255;255m%} set branch_color="underline italic ffc0c0 ul:white" set ahead_tracking_color="9f9" diff --git a/tcshrc.prompt.final b/tcshrc.prompt.final index 7a352b3..da6b5c9 100644 --- a/tcshrc.prompt.final +++ b/tcshrc.prompt.final @@ -25,6 +25,14 @@ if( "${curr_branch_color}" != "${branch_color}" ) then set branch_color_seq="%{[`__build_sgr_code no-csi reset ${curr_branch_color}`m" endif +if( ! $?curr_dirs_color ) then + set curr_dirs_color=impossible +endif +if( "${curr_dirs_color}" != "${dirs_color}" ) then + set curr_dirs_color="${dirs_color}" + set dirs_color_seq="%{[`__build_sgr_code no-csi reset ${curr_dirs_color}`m" +endif + if( ! $?curr_ahead_tracking_color ) then set curr_ahead_tracking_color=impossible endif @@ -313,6 +321,7 @@ set host_prompt_view="" set git_prompt_view="" set path_prompt_view="" set line_spacer_view="" +set dirs_prompt_view="" if( ! $?CSHENV_DISABLE_PROMPT_SIGIL ) then set prompt_reference_view="${prompt_reference}" @@ -352,8 +361,14 @@ endif if( ! $?CSHENV_DISABLE_PROMPT_PATH ) then set path_prompt_view="%{${path_color_seq}%}${path_prompt}%{${sgr_reset}%}" endif +if( ! $?CSHENV_DISABLE_PROMPT_DIRS ) then + set dirs_prompt=`dirs -v | wc -l` + if( ${dirs_prompt} > 1 ) then + set dirs_prompt_view=" {%{${dirs_color_seq}%}${dirs_prompt}%{${sgr_reset}%}}" + endif +endif -set prompt_cool="%{\n%}${align_prefix}${battery_prefix}${battery_prompt}${date_prompt_view}%{ %}${time_prompt_view}${align_suffix}${brace_color_seq}\[%{${sgr_reset}%}${prompt_reference_view}${line_prompt_view}${depth_prompt_view}${line_spacer_view}${user_prompt_view}${at_view}${host_prompt_view}${git_prompt_view}${path_prompt_view}${brace_color_seq}\]%{${sgr_reset}%}${prompt_color_seq}${end_prompt}%{${sgr_reset}${text_color_seq}%} " +set prompt_cool="%{\n%}${align_prefix}${battery_prefix}${battery_prompt}${date_prompt_view}%{ %}${time_prompt_view}${align_suffix}${brace_color_seq}\[${prompt_reference_view}${line_prompt_view}${depth_prompt_view}${line_spacer_view}${user_prompt_view}${at_view}${host_prompt_view}${git_prompt_view}${path_prompt_view}${dirs_prompt_view}${brace_color_seq}\]${prompt_color_seq}${end_prompt}%{${text_color_seq}%} "