-
Notifications
You must be signed in to change notification settings - Fork 1
/
doom.zsh-theme
executable file
·138 lines (114 loc) · 3.92 KB
/
doom.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#
# Doom ZSH (a spaceship (and more...) inspiration) theme.
#
# Author: CMOISDEAD, camilodavila.vercel.app
# License: MIT
# https://github.com/CMOISDEAD/doom-zsh
# ------------------------------------------------------------------------------
# VARIABLE
# set global variables
# ------------------------------------------------------------------------------
DOOM_ROOT="$HOME/.oh-my-zsh/custom/themes/doom"
# ------------------------------------------------------------------------------
# GITSTATUS.PLUGIN
# initialize gitstatus.plugin
# ------------------------------------------------------------------------------
# the flags enable unstaget, untracked and more counters.
gitstatus_stop 'MY' && gitstatus_start -s -1 -u -1 -c -1 -d -1 'MY'
gitstatus_query -d $PWD MY
# ------------------------------------------------------------------------------
# SETUP
# setup requirements of the prompt
# ------------------------------------------------------------------------------
DOOM_SECTIONS_LEFT=(
logo # Custom logo
time # Time stampts section
user # Username section
host # Hostname section
dir # Current directory section
node # Node.js section
rust # Rust section
pyenv # Pyenv section
#aws # Amazon Web Services section
exec_time # Execution time
#vi_mode # Vi-mode indicator
#jobs # Background jobs indicator
new_line # Line break
status # Last command return status.
char # Prompt character
# NOTE: this sections still on work. (help wanted)
#gradle # Gradle section
#maven # Maven section
#package # Package version
#ruby # Ruby section
#elm # Elm section
#elixir # Elixir section
#xcode # Xcode section
#swift # Swift section
#golang # Go section
#php # PHP section
#haskell # Haskell Stack section
#julia # Julia section
#docker # Docker section
#gcloud # Google Cloud Platform section
#venv # virtualenv section
#conda # conda virtualenv section
#dotnet # .NET section
#ember # Ember.js section
#kubectl # Kubectl context section
#terraform # Terraform workspace section
#ibmcloud # IBM Cloud section
)
DOOM_SECTIONS_RIGHT=(
gitstatus # Git section ( branch status )
#battery # Battery level and status
)
DOOM_LIBS=(
"lib/hooks.zsh" # Zsh hooks
)
# ------------------------------------------------------------------------------
# SOURCE SECTIONS
# sourcing sections, hooks, etc
# ------------------------------------------------------------------------------
# Load internals
for lib in "${DOOM_LIBS[@]}"; do
builtin source "$DOOM_ROOT/$lib"
done
# Load sections
for section in "${DOOM_SECTIONS_LEFT[@]}" "${DOOM_SECTIONS_RIGHT[@]}"; do
if [[ -f "$DOOM_ROOT/sections/$section.zsh" ]]; then
source "$DOOM_ROOT/sections/$section.zsh"
else
echo "Section '$section' was not loaded."
fi
done
# ------------------------------------------------------------------------------
# PROMPTS
# entry point of prompts
# ------------------------------------------------------------------------------
doom_prompt() {
# Retrieve exit code of last command to use in status and char
prompt=""
[[ -z $DOOM_SECTIONS_LEFT ]] && return
for section in $DOOM_SECTIONS_LEFT; do
prompt+="$(doom_$section)"
done
echo $prompt
}
doom_rprompt() {
rprompt=""
[[ -z $DOOM_SECTIONS_RIGHT ]] && return
for section in $DOOM_SECTIONS_RIGHT; do
rprompt+="$(doom_$section)"
done
echo $rprompt
}
PROMPT='$(doom_prompt)'
RPROMPT='$(doom_rprompt)'
# ------------------------------------------------------------------------------
# HOOKS
# add custom hooks functions
# ------------------------------------------------------------------------------
add-zsh-hook preexec prompt_doom_preexec
add-zsh-hook precmd prompt_doom_precmd
add-zsh-hook chpwd prompt_doom_chpwd