2021-01-16 21:52:11 +01:00
|
|
|
# My custom theme:
|
|
|
|
# - single line
|
|
|
|
# - quite simple by default: user@host:$PWD
|
|
|
|
# - green for local shell as non root
|
|
|
|
# - red for ssh shell as non root
|
|
|
|
# - magenta for root sessions
|
|
|
|
# - prefix with remote address for ssh shells
|
|
|
|
# - prefix to detect docker containers or chroot
|
|
|
|
# - git plugin to display current branch and status
|
2011-11-05 00:34:15 +01:00
|
|
|
|
2024-03-26 09:55:16 +01:00
|
|
|
# git plugin
|
2011-11-16 19:44:02 +01:00
|
|
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}("
|
2011-11-05 00:34:15 +01:00
|
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}"
|
|
|
|
|
2021-01-16 21:52:11 +01:00
|
|
|
|
|
|
|
# by default, use green for user@host and no prefix
|
|
|
|
local ZSH_ESSEMBEH_COLOR="green"
|
|
|
|
local ZSH_ESSEMBEH_PREFIX=""
|
|
|
|
if [[ -n "$SSH_CONNECTION" ]]; then
|
|
|
|
# display the source address if connected via ssh
|
|
|
|
ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[$(echo $SSH_CONNECTION | awk '{print $1}')]%{$reset_color%} "
|
|
|
|
# use red color to highlight a remote connection
|
|
|
|
ZSH_ESSEMBEH_COLOR="red"
|
2024-03-26 09:55:16 +01:00
|
|
|
elif [[ -r /etc/debian_chroot ]]; then
|
2021-01-16 21:52:11 +01:00
|
|
|
# prefix prompt in case of chroot
|
|
|
|
ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[chroot:$(cat /etc/debian_chroot)]%{$reset_color%} "
|
|
|
|
elif [[ -r /.dockerenv ]]; then
|
2021-12-01 12:20:31 +01:00
|
|
|
# also prefix prompt inside a docker container
|
2021-01-16 21:52:11 +01:00
|
|
|
ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[docker]%{$reset_color%} "
|
|
|
|
fi
|
|
|
|
if [[ $UID = 0 ]]; then
|
|
|
|
# always use magenta for root sessions, even in ssh
|
|
|
|
ZSH_ESSEMBEH_COLOR="magenta"
|
|
|
|
fi
|
2024-06-17 21:38:21 +02:00
|
|
|
PROMPT='${ZSH_ESSEMBEH_PREFIX}%{$fg[$ZSH_ESSEMBEH_COLOR]%}%n@%M%{$reset_color%}:%{%B$fg[yellow]%}%~%{$reset_color%b%} $(git_prompt_info)%(!.#.$) '
|
2021-01-16 21:52:11 +01:00
|
|
|
RPROMPT="%(?..%{$fg[red]%}%?%{$reset_color%})"
|