-
Notifications
You must be signed in to change notification settings - Fork 0
/
magicalness.zsh-theme
87 lines (67 loc) · 2.3 KB
/
magicalness.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
###################
# BUILDING PROMPT #
###################
# username --> %n
# machine name --> %m
# current location --> %~
# Main prompt (left)
PROMPT='╭─$(nvm_prompt_info) $fg[magenta]$(get_pwd)%b
╰───$_SYMBOL'
# Main prompt (right)
RPROMPT='$(check_git_prompt_info)'
##############
# EMOJI BITS #
##############
# Get more options:
# http://getemoji.com/
# https://unicode.org/emoji/charts/full-emoji-list.html
# Ctrl + Cmd + Space on Mac to open up the emoji keyboard
EMOJI=(💩 👻 💀 ☠ 👽 👾 🤖 🐶 🦊 🐻 🐼 🐨 🐯 🦁 🐮 🐷 🐒 🦉 🦄 🐌 🐢 🦑 🐙 🐠 🐟 🐡 🐬 🦈 🐳 🐄 🐘 🍄 🌻 ☃️ ⛄️ ❄️ 🔥 🍌 🍍 🍓 🥝 🍭 🎨 🚀 🏖 🏝 💻 📚 🖌 🖍 📓 😜 🙄 🤓 👩🏻💻 👩🏻🚀 👸🏼 💃 🛀🏻 🤺 🖕🏻 ✌🏻 🤘🏻 👊🏻 👟 🎩 🐥 🦆 )
function random_emoji {
echo -n "$EMOJI[$RANDOM%$#EMOJI+1] "
}
# ➭ ✔ ✈ ✭ ✗ ➦ ✂ ✱
# Prompt symbols
# _SYMBOL="%{$fg[red]%}➭%{$fg[yellow]%}➭%{$fg[cyan]%}➭ "
_SYMBOL="<< $(random_emoji) >> "
######################
# Git Prompt Builder #
######################
ZSH_THEME_GIT_PROMPT_PREFIX="["
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[white]%}]"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[red]%} ✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔"
# Git sometimes goes into a detached head state. git_prompt_info doesn't
# return anything in this case. So wrap it in another function and check
# for an empty string.
function check_git_prompt_info() {
if git rev-parse --git-dir > /dev/null 2>&1; then
if [[ -z $(git_prompt_info) ]]; then
echo "%{$fg[magenta]%}detached-head%{$reset_color%})"
else
echo "$(git_prompt_info)"
fi
fi
}
######################
# NVM Prompt Builder #
######################
ZSH_THEME_NVM_PROMPT_PREFIX="%{$fg[green]%}⬡ %{$fg[white]%}"
ZSH_THEME_NVM_PROMPT_SUFFIX="%{$fg[white]%}"
########################
# Location Path Setter #
########################
function get_pwd(){
git_root=$PWD
while [[ $git_root != / && ! -e $git_root/.git ]]; do
git_root=$git_root:h
done
if [[ $git_root = / ]]; then
unset git_root
prompt_short_dir=%~
else
parent=${git_root%\/*}
prompt_short_dir=${PWD#$parent/}
fi
echo $prompt_short_dir
}