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

##     ## ##       ##     ##
###   ### ##       ##     ##
#### #### ##       ##     ##
## ### ## ##       #########
##     ## ##       ##     ##
##     ## ##       ##     ##
##     ## ######## ##     ##
10
11
12
13
14

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

15
16
17
18
19
20
# To customize symbols (e.g MLH_AT_SYMBOL), simply set them as environment variables
# for example in your ~/.zshrc file, like this:
# MLH_AT_SYMBOL=" at "
# 
# Settings *must* be set before sourcing oh-my-zsh.sh the .zshrc file.
#
21
22
# To easily discover colors and their codes, type `spectrum_ls` in the terminal

23
24
25
26
# right prompt default settings
if [ -z "$MLH_PRINT_EXIT_CODE" ]; then
  MLH_PRINT_EXIT_CODE=true
fi
27

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
if [ -z "$MLH_PRINT_TIME" ]; then
  MLH_PRINT_TIME=false
fi

# left prompt symbols default settings

if [ -z "$MLH_AT_SYMBOL" ]; then
  MLH_AT_SYMBOL="@"
fi

if [ -z "$MLH_IN_SYMBOL" ]; then
  MLH_IN_SYMBOL=" in "
fi

if [ -z "$MLH_ON_SYMBOL" ]; then
  MLH_ON_SYMBOL=" on "
fi

if [ -z "$MLH_SHELL_SYMBOL" ]; then
  MLH_SHELL_SYMBOL="$ "
fi
49

50
# colors
51
52
53
54
55
56
57
USER_COLOR="%F{001}"
DEVICE_COLOR="%F{033}"
DIR_COLOR="%F{220}"
BRANCH_COLOR="%F{001}"
TIME_COLOR="%F{033}"

username() {
58
  echo "$USER_COLOR%n%f"
59
60
}

61
# Prints device name
62
device() {
63
  echo "$DEVICE_COLOR%m%f"
64
65
}

66
# Prints the current directory
67
directory() {
68
  echo "$DIR_COLOR%1~%f"
69
70
}

71
# Prints current time
72
current_time() {
73
  if [ "$MLH_PRINT_TIME" = true ]; then
74
75
    echo " $TIME_COLOR%*%f"
  fi
76
77
}

78
79
# Prints exit code of the last executed command
exit_code() {
80
  if [ "$MLH_PRINT_EXIT_CODE" = true ]; then
81
82
    echo "%(?..%F{001}exit %?)%f"
  fi
83
84
}

85
86
87
88
prompt_end() {
  printf "\n$MLH_SHELL_SYMBOL"
}

89
# Set git_prompt_info text
90
ZSH_THEME_GIT_PROMPT_PREFIX="${MLH_ON_SYMBOL}${BRANCH_COLOR}"
91
92
93
94
95
ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""

# %B and %b make the text bold
96
PROMPT='%b$(username)$MLH_AT_SYMBOL$(device)$MLH_IN_SYMBOL$(directory)$(git_prompt_info)%b$(prompt_end)'
97
RPROMPT="$(exit_code)$(current_time)"