-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathj45.zsh-theme
67 lines (46 loc) · 1.21 KB
/
j45.zsh-theme
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#FILE LOCATION: ~/.oh-my-zsh/themes/j45.zsh-theme
if [[ "${USER_ALIAS}" == "" ]]; then
USER_ALIAS=${USER}
fi
function theme_precmd {
local TERMWIDTH
(( TERMWIDTH = ${COLUMNS} - 1 ))
###
# Truncate the path if it's too long.
PR_PWDLEN=""
if [[ "${USER_ALIAS}" == "" ]]; then
USER_ALIAS=${USER}
fi
if [[ "${USER_ALIAS_LENGTH}" == "" ]]; then
USER_ALIAS_LENGTH=${#${USER_ALIAS}}
fi
local promptsize=${#${(%):-------[@%m:%l)---()--}}
local pwdsize=${#${(%):-%~}}
if [[ "${promptsize} + ${pwdsize}" -gt ${TERMWIDTH} ]]; then
((PR_PWDLEN=${TERMWIDTH} - ${promptsize}))
fi
}
setprompt () {
###
# Need this so the prompt will work.
setopt prompt_subst
###
# See if we can use colors.
PR_NO_COLOUR="%{${terminfo[sgr0]}%}"
PR_CHAR='>'
###
# Finally, the prompt.
PROMPT='[ ${USER}@${HOST} \
%${PR_PWDLEN}<...<%~%<< ] \
${PR_CHAR} '
# display exitcode on the right when >0
return_code="%(?..%{${fg[red]}%}%? ⮐%{${reset_color}%})"
RPROMPT=' ${return_code}'
}
setprompt
autoload -U add-zsh-hook
add-zsh-hook precmd theme_precmd
ZSH_AUTOSUGGEST_STRATEGY=(completion)
fortune | cowsay | lolcat -S 23
echo
neofetch