1
1
Fork 0

Include user in prompt if not the normal user

This commit is contained in:
Jonathan Schleifer 2020-08-23 12:07:26 +00:00
parent bdfce892e4
commit cb958c0da3
4 changed files with 17 additions and 4 deletions

7
zshrc
View file

@ -14,6 +14,7 @@ local ls=""
local ls_color="auto"
local ls_on_cd="yes"
local ls_on_init="no"
local normal_user="js"
if [ "$COLORTERM" = "24bit" -o "$COLORTERM" = "truecolor" \
-o "$terminfo[colors]" = 16777216 ]; then
@ -99,7 +100,11 @@ set_prompt() {
branch+="%F{$color_vcs_braces})"
fi
PS1="%F{$color_host}%m %F{$color_cwd}%c$branch"
if [ "$(whoami)" != "$normal_user" ]; then
local user="%n@"
fi
PS1="%F{$color_host}$user%m %F{$color_cwd}%c$branch"
PS1+="%F{$color_suffix}%(!.#.>)%f "
PS2="%B>%b "
RPS1="%(1j.%F{$color_jobs}%B%j%b%f.)%(?..%(1j. .)"