Fine grained control over prompt elements.

Use `CSHENV_DISABLE_PROMPT_` env vars to control these.
This commit is contained in:
2022-06-03 21:31:26 -04:00
parent 910f194c4e
commit 328c1c13e3
2 changed files with 53 additions and 7 deletions

View File

@ -122,12 +122,7 @@ if( $?CSHENV_DEBUG ) then
endif
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="${text_color_seq}\- "
endif
endif
set depth_prompt="${depth_color_seq}(${shlvl})"
#we "convert" pts/$number entries to ttypK entries?
set line_prompt="${line_color_seq}`tty | sed -e 's;/dev/tty;;' -e 's;/dev/pts/;p/;' -e 's;/dev/;;' -e 's/not a tty/${unknown_tty}/'`"

View File

@ -142,7 +142,58 @@ else
endif
#set prompt_cool="%{\n%}${align_prefix}${battery_prefix}${battery_prompt}${date_prompt}${align_suffix}${git_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}"
set prompt_cool="%{\n%}${align_prefix}${battery_prefix}${battery_prompt}${date_prompt}${align_suffix}${brace_color_seq}\[${prompt_reference}${line_prompt}${depth_prompt}${user_prompt}${at_color_seq}@${host_prompt}${text_color_seq}\: ${git_prompt}${path_prompt}${brace_color_seq}\]${end_prompt}"
set prompt_reference_view=""
set line_prompt_view=""
set depth_prompt_view=""
set user_prompt_view
set at_view=""
set host_prompt_view=""
set git_prompt_view=""
set path_prompt_view=""
set line_spacer_view=""
if( ! $?CSHENV_DISABLE_PROMPT_SIGIL ) then
set prompt_reference_view="${prompt_reference}"
endif
if( ! $?CSHENV_DISABLE_PROMPT_TTY ) then
set line_prompt_view="${line_prompt}"
set line_spacer_view="${text_color_seq}\- "
endif
if( ! $?CSHENV_DISABLE_PROMPT_NESTING ) then
set depth_prompt_spacing=""
if( ! $?CSHENV_DISABLE_PROMPT_TTY ) then
set depth_prompt_spacing=" "
endif
set depth_prompt_view="${depth_prompt_spacing}${depth_prompt}"
if( $?CSHENV_HIDE_SHELL_LEVEL_AT_ONE ) then
if( ${shlvl} == 1 ) then
set depth_prompt_view=""
endif
endif
endif
if( ! $?CSHENV_DISABLE_PROMPT_USER ) then
set user_prompt_view="${user_prompt}"
if( ! $?CSHENV_DISABLE_PROMPT_HOST ) then
set at_view="${at_color_seq}@"
endif
endif
if( ! $?CSHENV_DISABLE_PROMPT_HOST ) then
set host_prompt_tail=": "
if( $?CSHENV_DISABLE_PROMPT_GIT && $?CSHENV_DISABLE_PROMPT_PATH ) then
set host_prompt_tail=""
endif
set host_prompt_view="${host_prompt}${text_color_seq}${host_prompt_tail}"
endif
if( ! $?CSHENV_DISABLE_PROMPT_GIT ) then
set git_prompt_view="${git_prompt}"
endif
if( ! $?CSHENV_DISABLE_PROMPT_PATH ) then
set path_prompt_view="${path_prompt}"
endif
set prompt_cool="%{\n%}${align_prefix}${battery_prefix}${battery_prompt}${date_prompt}${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}${brace_color_seq}\]${end_prompt}"
if( ! ${?cshenv_user_prompt_override} ) then
set prompt="$prompt_cool"