2021-06-14 01:16:34 +08:00
|
|
|
# The Official Theme of Major League Hacking
|
|
|
|
|
|
|
|
## ## ## ## ##
|
|
|
|
### ### ## ## ##
|
|
|
|
#### #### ## ## ##
|
|
|
|
## ### ## ## #########
|
|
|
|
## ## ## ## ##
|
|
|
|
## ## ## ## ##
|
|
|
|
## ## ######## ## ##
|
2020-07-05 23:59:12 +08:00
|
|
|
|
|
|
|
# # # # # # # # # # # # # # # # # #
|
|
|
|
# # # Feel free to customize! # # #
|
|
|
|
# # # # # # # # # # # # # # # # # #
|
|
|
|
|
|
|
|
# To easily discover colors and their codes, type `spectrum_ls` in the terminal
|
|
|
|
|
2021-06-14 01:16:34 +08:00
|
|
|
# enable or disable particular elements
|
|
|
|
PRINT_EXIT_CODE=true
|
|
|
|
PRINT_TIME=true
|
|
|
|
|
|
|
|
# symbols
|
2020-07-05 23:59:12 +08:00
|
|
|
AT_SYMBOL=" @ "
|
|
|
|
IN_SYMBOL=" in "
|
|
|
|
ON_SYMBOL=" on "
|
2021-06-14 01:16:34 +08:00
|
|
|
SHELL_SYMBOL="$"
|
2020-07-05 23:59:12 +08:00
|
|
|
|
2021-06-14 01:16:34 +08:00
|
|
|
# colors
|
2020-07-05 23:59:12 +08:00
|
|
|
USER_COLOR="%F{001}"
|
|
|
|
DEVICE_COLOR="%F{033}"
|
|
|
|
DIR_COLOR="%F{220}"
|
|
|
|
BRANCH_COLOR="%F{001}"
|
|
|
|
TIME_COLOR="%F{033}"
|
|
|
|
|
|
|
|
username() {
|
2021-06-14 01:16:34 +08:00
|
|
|
echo "$USER_COLOR%n%f"
|
2020-07-05 23:59:12 +08:00
|
|
|
}
|
|
|
|
|
2021-06-14 01:16:34 +08:00
|
|
|
# Prints device name
|
2020-07-05 23:59:12 +08:00
|
|
|
device() {
|
2021-06-14 01:16:34 +08:00
|
|
|
echo "$DEVICE_COLOR%m%f"
|
2020-07-05 23:59:12 +08:00
|
|
|
}
|
|
|
|
|
2021-06-14 01:16:34 +08:00
|
|
|
# Prints the current directory
|
2020-07-05 23:59:12 +08:00
|
|
|
directory() {
|
2021-06-14 01:16:34 +08:00
|
|
|
echo "$DIR_COLOR%1~%f"
|
2020-07-05 23:59:12 +08:00
|
|
|
}
|
|
|
|
|
2021-06-14 01:16:34 +08:00
|
|
|
# Prints current time
|
2020-07-05 23:59:12 +08:00
|
|
|
current_time() {
|
2021-06-14 01:16:34 +08:00
|
|
|
if [ "$PRINT_TIME" = true ]; then
|
|
|
|
echo " $TIME_COLOR%*%f"
|
|
|
|
fi
|
2020-07-05 23:59:12 +08:00
|
|
|
}
|
|
|
|
|
2021-06-14 01:16:34 +08:00
|
|
|
# Prints exit code of the last executed command
|
|
|
|
exit_code() {
|
|
|
|
if [ "$PRINT_EXIT_CODE" = true ]; then
|
|
|
|
echo "%(?..%F{001}exit %?)%f"
|
|
|
|
fi
|
2020-07-05 23:59:12 +08:00
|
|
|
}
|
|
|
|
|
2021-06-14 01:16:34 +08:00
|
|
|
# Set git_prompt_info text
|
2020-07-05 23:59:12 +08:00
|
|
|
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
|
2021-06-14 01:16:34 +08:00
|
|
|
PROMPT='%b$(username)$AT_SYMBOL$(device)$IN_SYMBOL$(directory)$(git_prompt_info)%b $SHELL_SYMBOL '
|
|
|
|
RPROMPT="$(exit_code)$(current_time)"
|