tcsh: change color if last exit code != 0

master
Nakidai 2023-11-01 17:58:37 +03:00
parent ce68ece5bc
commit 09c82d0ae8
Signed by untrusted user who does not match committer: nakidai
GPG Key ID: 914675D395210A97
2 changed files with 4 additions and 2 deletions

3
tcsh/.precmd.tcsh Normal file
View File

@ -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} "

View File

@ -8,10 +8,9 @@ if ($?prompt) then
set __host_color="%{\033[38;2;140;170;238m%}" set __host_color="%{\033[38;2;140;170;238m%}"
set __git_color="%{\033[38;2;131;139;167m%}" set __git_color="%{\033[38;2;131;139;167m%}"
set __path_color="%{\033[38;2;202;158;230m%}" set __path_color="%{\033[38;2;202;158;230m%}"
set __prompt_key_color="${__host_color}"
set __reset_color="%{\033[0m%}" 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 endif
alias l "ls -lah" alias l "ls -lah"