From 41fb29eef09054cf209ab12659c39062d2f8cde8 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Tue, 2 Mar 2021 06:45:49 -0500 Subject: [PATCH] Add prompt reference symbols. This one is a bit shaky still, but I now have symbolic, colour-coded tags in the prompt. This can be used to point out interesting lines in pair programming. --- tcshrc.prompt.defs | 79 ++++++++++++++++++++++++++++++++++++++++----- tcshrc.prompt.final | 51 +++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+), 8 deletions(-) create mode 100644 tcshrc.prompt.final diff --git a/tcshrc.prompt.defs b/tcshrc.prompt.defs index 9656130..b5748fb 100644 --- a/tcshrc.prompt.defs +++ b/tcshrc.prompt.defs @@ -14,6 +14,74 @@ if( ! $?unknown_tty ) then endif +# R G Y B C M +set reference_colors=( ${csi}91m ${csi}92m ${csi}93m ${csi}38\;5\;33m ${csi}95m ${csi}96m ) + +# R G Y B M +set reference_colors=( ${csi}91m ${csi}92m ${csi}93m ${csi}38\;5\;33m ${csi}96m ) + +# Select a set of Unicode codepoints for prompt referencing... +set referencechars_raw="" + +# Nuke Symbol +set referencechars_raw="${referencechars_raw} 2622" + +# Keyboard Symbol (Didn't look good -- spilled (not pushed) over 1.5 cells) +set keyboard_sym="2328" +set referencechars_raw="${referencechars_raw} 2328" + +# Telephone (Spills over 1 cell.) +set referencechars_raw="${referencechars_raw} 260e" + +# Clover +set referencechars_raw="${referencechars_raw} 2618" + +# Music notes +#set referencechars_raw="${referencechars_raw} 2669 266a 266b 266c" + +# One Single music note, +#set referencechars_raw="${referencechars_raw} 266a" +# One double music note +#set referencechars_raw="${referencechars_raw} 266b" +set referencechars_raw="${referencechars_raw} 266c" + +# Dice +#set referencechars_raw="${referencechars_raw} 2680 2681 2682 2683 2684 2685" + +# Card suits +set referencechars_raw="${referencechars_raw} 2660 2663 2665 2666" + +# Inner planet symbols (Mercury, Venus, Earth, Mars) +set referencechars_raw="${referencechars_raw} 263f 2640 2641 2642" + +# Outer Planet symbols (Jupiter, Saturn, Uranus, Neptune, Pluto) +#set referencechars_raw="${referencechars_raw} 2643 2644 2645 2646 2647" + +# Hollow Chess pieces +#set referencechars_raw="${referencechars_raw} 2654 2655 2656 2657 2658 2659" + +# Filled Chess pieces +#set referencechars_raw="${referencechars_raw} 265a 265b 265c 265d 265e 265f" + +# Roman Numerals +#set referencechars_raw="${referencechars_raw} 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 216a 216b" + +# Misc stuff -- colour? baseball Takes up too many width slots. Throws off alignment. +#set referencechars_raw="${referencechars_raw} 26be" + +#echo ${referencechars[1]} +set prompt_hcolor=0 +set prompt_hsym=0 + +set referencechars=() +foreach ch ($referencechars_raw) + set referencechars=( $referencechars `env LC_ALL=C.UTF-8 printf "\u${ch}"` ) +end + +# Rotation +alias precmd 'source ${CSHENV_DIR}/tcshrc.prompt.final' +#alias postcmd echo doit + set promptchars='%#' set prompt_simple="${oldp_color_seq}[%n@%m: %c]%# " @@ -33,10 +101,10 @@ if( $?CSHENV_DEBUG ) then endif -set depth_prompt=" ${depth_color_seq}(${shlvl})" +set depth_prompt=" ${depth_color_seq}(${shlvl})${text_color_seq}\- " if( $?CSHENV_HIDE_SHELL_LEVEL_AT_ONE ) then if( $shlvl == 1 ) then - set depth_prompt="" + set depth_prompt="${text_color_seq}\- " endif endif @@ -47,15 +115,10 @@ set host_prompt="${host_color_seq}${CSHENV_HOSTNAME}" set path_prompt="${path_color_seq}%c02" set end_prompt="${prompt_color_seq}%#${command_color_seq} " - -set prompt_cool="${date_prompt}${text_color_seq}%L${brace_color_seq}\[${line_prompt}${depth_prompt}${text_color_seq}\- ${user_prompt}${at_color_seq}@${host_prompt}${text_color_seq}\: ${path_prompt}${brace_color_seq}\]${end_prompt}" - -if( ! ${?cshenv_user_prompt_override} ) then - set prompt="$prompt_cool" -endif alias oldp 'set prompt="$prompt_simple"; set cshenv_user_prompt_override' alias newp 'set prompt="$prompt_cool"; set cshenv_user_prompt_override' +source ${CSHENV_DIR}/tcshrc.prompt.final ########################### # vim:filetype=tcsh ########################### diff --git a/tcshrc.prompt.final b/tcshrc.prompt.final new file mode 100644 index 0000000..bf70099 --- /dev/null +++ b/tcshrc.prompt.final @@ -0,0 +1,51 @@ +############################ +### Final Prompt Setting ### +############################ +@ prompt_hcolor = $prompt_hcolor % ${#reference_colors} +@ prompt_hsym = $prompt_hsym % ${#referencechars} + +if( ${prompt_hcolor} == 0 ) then + #if( $?CSHENV_DEBUG ) then + #echo colorshuffle + #endif + #echo  + set reference_colors=`shuf -e $reference_colors` +endif + + +if( ${prompt_hsym} == 0 ) then # && ${prompt_hcolor} == 0 ) then + if( $?CSHENV_DEBUG ) then + echo symbolshuffle + endif + #echo  + set referencechars=`shuf -e $referencechars` + #set reference_colors=`shuf -e $reference_colors` +endif + +@ prompt_hcolor = ${prompt_hcolor} + 1 +@ prompt_hsym = ${prompt_hsym} + 1 + +if( $?CSHENV_DEBUG ) then + echo ${prompt_hcolor} ${prompt_hsym} + echo "Setting prompt" +endif + +set prompt_reference_core="%{${reference_colors[${prompt_hcolor}]}%}${referencechars[${prompt_hsym}]}" +#if( ${referencechars[${prompt_hsym}]} == `env LC_ALL=C.UTF-8 printf "\u2328"` ) then +# set prompt_reference="%{${dim}%}<${prompt_reference_core} %{${dim}%}> " +#else +# set prompt_reference="%{${dim}%}< ${prompt_reference_core} %{${dim}%}> " +#endif +set prompt_reference="%{${dim}%}< ${prompt_reference_core} %{${dim}%}> " +#set prompt_reference="%{${csi}0;48\;5\;7m%}(${prompt_reference_core}%{${csi}0;48\;5\;7m%})%{${dim}%}" +#set prompt_reference="${prompt_reference_core}%{${text_color_seq}%} \- " + +set prompt_cool="\n${date_prompt}${brace_color_seq}\[${prompt_reference}${line_prompt}${depth_prompt}${user_prompt}${at_color_seq}@${host_prompt}${text_color_seq}\: ${path_prompt}${brace_color_seq}\]${end_prompt}" + +if( ! ${?cshenv_user_prompt_override} ) then + set prompt="$prompt_cool" +endif + +########################### +# vim:filetype=tcsh +###########################