-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbruh.zsh-theme
56 lines (51 loc) · 1.29 KB
/
bruh.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
# bruh theme
# setup
setopt prompt_subst
hl='%F{green}'
reset='%F{fb_default_code}'
function preexec() {
before=$EPOCHREALTIME
}
function precmd() {
git_commit_age=''
if [ -z "$SSH_CONNECTION" ]; then
connection=''
else
user="$(whoami)"
hostname="$(hostname)"
connection="$user@$hostname "
fi
if [ -z "${before}" ]; then
elapsed=''
else
after=$EPOCHREALTIME
raw_elapsed=$(echo "$after-$before" | bc)
elapsed="$hl$(bruh tf $raw_elapsed)$reset "
before=''
fi
git_dirty=''
git_top_level="$(git rev-parse --show-toplevel -q 2>/dev/null)"
if [ $? -eq 0 ]
then
git_branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null) "
git_shorthash="$hl$(git rev-parse --short HEAD 2>/dev/null)$reset "
if [ -d "$PWD/.git" ]; then
git_raw_last_commit_age="$(git show -s --format=%ct 2>/dev/null)"
if [ $? -eq 0 ]; then
git_commit_age="$(bruh lca $(date +%s) $git_raw_last_commit_age)"
fi
else
fi
$(git diff-index --quiet HEAD -- 2>/dev/null)
do_we_have_changes=$?
if [ $do_we_have_changes -ne 0 ]; then
git_dirty="$hl+$reset "
fi
else
git_branch=''
git_shorthash=''
git_commit_age=''
fi
}
PROMPT=' $connection$elapsed$(bruh cwd) '
RPROMPT='$git_dirty$git_branch$git_shorthash$git_commit_age'