From 09c82d0ae8a2954a97f9f635a90e506a705edad0 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Wed, 1 Nov 2023 17:58:37 +0300 Subject: [PATCH] tcsh: change color if last exit code != 0 --- tcsh/.precmd.tcsh | 3 +++ tcsh/.tcshrc | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 tcsh/.precmd.tcsh diff --git a/tcsh/.precmd.tcsh b/tcsh/.precmd.tcsh new file mode 100644 index 0000000..94e693d --- /dev/null +++ b/tcsh/.precmd.tcsh @@ -0,0 +1,3 @@ +set __prompt_key_color="${__host_color}" +if (! $__last_code == 0) set __prompt_key_color="%{\033[38;2;231;130;132m%}" +set prompt="${__host_color}%n@%m ${__git_color}`__git_current_branch`${__path_color}%~ ${__prompt_key_color}${__prompt_key}${__reset_color}${__reset_cursor} " diff --git a/tcsh/.tcshrc b/tcsh/.tcshrc index 0c36e6c..a69c967 100644 --- a/tcsh/.tcshrc +++ b/tcsh/.tcshrc @@ -8,10 +8,9 @@ if ($?prompt) then set __host_color="%{\033[38;2;140;170;238m%}" set __git_color="%{\033[38;2;131;139;167m%}" set __path_color="%{\033[38;2;202;158;230m%}" - set __prompt_key_color="${__host_color}" set __reset_color="%{\033[0m%}" - alias precmd 'set prompt="${__host_color}%n@%m ${__git_color}`__git_current_branch`${__path_color}%~ ${__prompt_key_color}${__prompt_key}${__reset_color}${__reset_cursor} "' + alias precmd 'set __last_code=$?; source ~/.precmd.tcsh' endif alias l "ls -lah"