mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-24 12:31:31 +01:00
theme: show hostname if in a ssh session
This commit is contained in:
parent
6485af4411
commit
64ade8d864
|
@ -6,14 +6,32 @@
|
||||||
# See the prompt expansion section in `info zsh` for more info
|
# See the prompt expansion section in `info zsh` for more info
|
||||||
|
|
||||||
function user_prompt(){
|
function user_prompt(){
|
||||||
# root printed on a red background
|
# prints info about username/hostname
|
||||||
local USER_PROMPT="%(#.%K{160}%F{255}[root]%k%f.)"
|
# for ssh connections
|
||||||
echo "$USER_PROMPT"
|
local p
|
||||||
# if [[ -n $SSH_CONNECTION ]]; then
|
local host
|
||||||
# local host="${purple}%B%m%b${default}"
|
if [[ $UID -eq 0 ]]; then
|
||||||
# host="%U${host}%u"
|
# root
|
||||||
# echo "$host"
|
echo -n "%F{255}[%f" # open square bracket
|
||||||
# fi
|
echo -n "%K{160}%F{255}%Broot%b%k%f"
|
||||||
|
if [[ $SSH_CONNECTION ]]; then
|
||||||
|
# add the white @
|
||||||
|
# echo -n '%F{255} at %f'
|
||||||
|
echo -n "%F{255}@%f"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ $SSH_CONNECTION ]]; then
|
||||||
|
if [[ $UID -ne 0 ]]; then
|
||||||
|
echo -n "%F{255}[%f" # open square bracket
|
||||||
|
fi
|
||||||
|
# underlined orange hostname (%m)
|
||||||
|
echo -n "%K{202}%B%F{255}%m%f%k%b"
|
||||||
|
if [[ $UID -ne 0 ]]; then
|
||||||
|
echo -n "%F{255}]%f" # close square bracket
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# close square bracket
|
||||||
|
if [[ $UID -eq 0 ]]; then echo "%F{255}]%f"; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function job_prompt() {
|
function job_prompt() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user