-
Notifications
You must be signed in to change notification settings - Fork 0
/
prompt.sh
47 lines (42 loc) · 1.23 KB
/
prompt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
_user_hburger() {
hburger hash -l 1 -c 1 -r 1 -- "$USER"
}
_cwd_hburgers() {
if [[ "$PWD" == "$HOME" || "$PWD" == "$HOME/"* ]]; then
printf "~"
relpath="${PWD#$HOME}"
else
printf " "
relpath="$PWD"
fi
if [ -z "$relpath" ]; then
printf "/"
return
fi
# Adjust these arguments to your liking
hburger hash-path \
--left-bun-length 4 \
--center-hashpatty-length 2 \
--right-bun-length 4 \
--padding-char " " \
--start-components 2 \
--end-components 2 \
--divider ":" \
-- "$relpath"
}
# For bash
_bash_host_hburger() {
hburger hash -l 1 -c 1 -r 1 -- "$HOSTNAME"
}
BASH_USERHOST_COLOR='\[\e[38;5;99m\]' # Purple
BASH_CWD_COLOR='\[\e[38;5;220m\]' # Yellow
BASH_RESET_COLOR='\[\e[0m\]'
PS1="$BASH_USERHOST_COLOR"'$(_user_hburger)@$(_bash_host_hburger)'"$BASH_CWD_COLOR"'[$(_cwd_hburgers)]'"$BASH_RESET_COLOR"'\$ '
# For zsh
_zsh_host_hburger() {
hburger hash -l 1 -c 1 -r 1 -- "$HOST"
}
ZSH_USERHOST_COLOR='%F{099}' # Purple
ZSH_CWD_COLOR='%F{220}' # Yellow
ZSH_RESET_COLOR='%f'
PROMPT="$ZSH_USERHOST_COLOR"'$(_user_hburger)@$(_zsh_host_hburger)'"$ZSH_CWD_COLOR"'[$(_cwd_hburgers)]'"$ZSH_RESET_COLOR"'%# '