mlh.zsh-theme 1.46 KB
Newer Older
1
2
3
4
5
6
7
8
9
# The Official Theme of Major League Hacking

##     ## ##       ##     ##
###   ### ##       ##     ##
#### #### ##       ##     ##
## ### ## ##       #########
##     ## ##       ##     ##
##     ## ##       ##     ##
##     ## ######## ##     ##
10
11
12
13
14
15
16

# # # # # # # # # # # # # # # # # #
# # # Feel free to customize! # # #
# # # # # # # # # # # # # # # # # #

# To easily discover colors and their codes, type `spectrum_ls` in the terminal

17
18
19
20
21
# enable or disable particular elements
PRINT_EXIT_CODE=true
PRINT_TIME=true

# symbols
22
23
24
AT_SYMBOL=" @ "
IN_SYMBOL=" in "
ON_SYMBOL=" on "
25
SHELL_SYMBOL="$"
26

27
# colors
28
29
30
31
32
33
34
USER_COLOR="%F{001}"
DEVICE_COLOR="%F{033}"
DIR_COLOR="%F{220}"
BRANCH_COLOR="%F{001}"
TIME_COLOR="%F{033}"

username() {
35
  echo "$USER_COLOR%n%f"
36
37
}

38
# Prints device name
39
device() {
40
  echo "$DEVICE_COLOR%m%f"
41
42
}

43
# Prints the current directory
44
directory() {
45
  echo "$DIR_COLOR%1~%f"
46
47
}

48
# Prints current time
49
current_time() {
50
51
52
  if [ "$PRINT_TIME" = true ]; then
    echo " $TIME_COLOR%*%f"
  fi
53
54
}

55
56
57
58
59
# Prints exit code of the last executed command
exit_code() {
  if [ "$PRINT_EXIT_CODE" = true ]; then
    echo "%(?..%F{001}exit %?)%f"
  fi
60
61
}

62
# Set git_prompt_info text
63
64
65
66
67
68
ZSH_THEME_GIT_PROMPT_PREFIX="${ON_SYMBOL}${BRANCH_COLOR}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""

# %B and %b make the text bold
69
70
PROMPT='%b$(username)$AT_SYMBOL$(device)$IN_SYMBOL$(directory)$(git_prompt_info)%b $SHELL_SYMBOL '
RPROMPT="$(exit_code)$(current_time)"