Skip to content

Commit

Permalink
uses different PS1 color when on server
Browse files Browse the repository at this point in the history
  • Loading branch information
gzagatti committed May 11, 2023
1 parent 4ce73ac commit 862c170
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
12 changes: 10 additions & 2 deletions shells/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,18 @@ if [[ $- == *i* ]]; then
local color=""
local reset_color=' '
if [[ $THEME == "leuven" ]]; then
color='$(if [[ $? == 0 ]]; then echo "\[\e[48:5:11m\]";else echo "\[\e[38:5:1m\]\[\e[48:5:9m\]"; fi)'
if [[ -n $SSH_CLIENT ]]; then
color='$(if [[ $? == 0 ]]; then echo "\[\e[47:5:10m\]";else echo "\[\e[38:5:1m\]\[\e[48:5:9m\]"; fi)'
else
color='$(if [[ $? == 0 ]]; then echo "\[\e[48:5:11m\]";else echo "\[\e[38:5:1m\]\[\e[48:5:9m\]"; fi)'
end
reset_color='\[\e[0m\] '
elif [[ $THEME == "dracula" ]]; then
color='$(if [[ $? == 0 ]]; then echo "\[\e[00;30m\]";else echo "\[\e[00;31m\]"; fi)'
if [[ -n $SSH_CLIENT ]]; then
color='$(if [[ $? == 0 ]]; then echo "\[\e[00;32m\]";else echo "\[\e[00;31m\]"; fi)'
else
color='$(if [[ $? == 0 ]]; then echo "\[\e[00;30m\]";else echo "\[\e[00;31m\]"; fi)'
end
reset_color='\[\e[0m\] \[\e[33m\]'
fi
printf %s "$color$(_precmd_ps1)$info$reset_color"
Expand Down
14 changes: 11 additions & 3 deletions shells/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,18 @@ if [[ $- == *i* ]]; then
# https://zsh.sourceforge.io/Doc/Release/Prompt-Expansion.html#Visual-effects
color=""
if [[ $THEME == "leuven" ]]; then
color='%(?.%K{11}.%K{9}%F{1})'
if [[ -n $SSH_CLIENT ]]; then
color='%(?.%K{10}.%K{9}%F{1})'
else
color='%(?.%K{11}.%K{9}%F{1})'
fi
LS_COLORS="no=00:fi=00:di=34::ln=32;102:so=37;107:pi=1;33:ex=31:bd=37;107:cd=37;107:su=37;107:sg=37;107:tw=35:ow=35"
elif [[ $THEME == "dracula" ]]; then
color='%(?.%F{black}.%F{red})'
if [[ -n $SSH_CLIENT ]]; then
color='%(?.%F{green}.%F{red})'
else
color='%(?.%F{black}.%F{red})'
fi
LS_COLORS="no=00:fi=00:di=34::ln=32:so=37:pi=1;33:ex=31:bd=37:cd=37:su=37:sg=37:tw=35:ow=35"
fi
local host_info_msg="[%m %n]:%1~ %#"
Expand Down Expand Up @@ -279,7 +287,7 @@ if [[ $- == *i* ]]; then
if [[ $THEME = "leuven" ]]; then
PS1="$color${dev_info_msg}${host_info_msg}%k%f "
elif [[ $THEME = "dracula" ]]; then
PS1="$color${dev_info_msg}${host_info_msg}%F{yellow} "
PS1="$color${dev_info_msg}${host_info_msg}%k%f "
else
PS1="$color${dev_info_msg}${host_info_msg} "
fi
Expand Down

0 comments on commit 862c170

Please sign in to comment.