2021-06-13 19:16:34 +02:00
|
|
|
# The Official Theme of Major League Hacking
|
|
|
|
|
|
|
|
## ## ## ## ##
|
|
|
|
### ### ## ## ##
|
|
|
|
#### #### ## ## ##
|
|
|
|
## ### ## ## #########
|
|
|
|
## ## ## ## ##
|
|
|
|
## ## ## ## ##
|
|
|
|
## ## ######## ## ##
|
2020-07-05 17:59:12 +02:00
|
|
|
|
|
|
|
# # # # # # # # # # # # # # # # # #
|
|
|
|
# # # Feel free to customize! # # #
|
|
|
|
# # # # # # # # # # # # # # # # # #
|
|
|
|
|
2021-08-25 10:25:26 +02:00
|
|
|
# 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 "
|
2024-03-26 09:55:16 +01:00
|
|
|
#
|
2021-08-25 10:25:26 +02:00
|
|
|
# Settings *must* be set before sourcing oh-my-zsh.sh the .zshrc file.
|
|
|
|
#
|
2020-07-05 17:59:12 +02:00
|
|
|
# To easily discover colors and their codes, type `spectrum_ls` in the terminal
|
|
|
|
|
2021-08-25 10:25:26 +02:00
|
|
|
# right prompt default settings
|
|
|
|
if [ -z "$MLH_PRINT_EXIT_CODE" ]; then
|
|
|
|
MLH_PRINT_EXIT_CODE=true
|
|
|
|
fi
|
2021-06-13 19:16:34 +02:00
|
|
|
|
2021-08-25 10:25:26 +02:00
|
|
|
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
|
2020-07-05 17:59:12 +02:00
|
|
|
|
2023-01-23 19:40:42 +01:00
|
|
|
if [ -z "$MLH_SHELL_SYMBOL_ROOT" ]; then
|
|
|
|
MLH_SHELL_SYMBOL_ROOT="# "
|
|
|
|
fi
|
|
|
|
|
2021-06-13 19:16:34 +02:00
|
|
|
# colors
|
2020-07-05 17:59:12 +02:00
|
|
|
USER_COLOR="%F{001}"
|
|
|
|
DEVICE_COLOR="%F{033}"
|
|
|
|
DIR_COLOR="%F{220}"
|
|
|
|
BRANCH_COLOR="%F{001}"
|
|
|
|
TIME_COLOR="%F{033}"
|
|
|
|
|
|
|
|
username() {
|
2021-06-13 19:16:34 +02:00
|
|
|
echo "$USER_COLOR%n%f"
|
2020-07-05 17:59:12 +02:00
|
|
|
}
|
|
|
|
|
2021-06-13 19:16:34 +02:00
|
|
|
# Prints device name
|
2020-07-05 17:59:12 +02:00
|
|
|
device() {
|
2021-06-13 19:16:34 +02:00
|
|
|
echo "$DEVICE_COLOR%m%f"
|
2020-07-05 17:59:12 +02:00
|
|
|
}
|
|
|
|
|
2021-06-13 19:16:34 +02:00
|
|
|
# Prints the current directory
|
2020-07-05 17:59:12 +02:00
|
|
|
directory() {
|
2021-06-13 19:16:34 +02:00
|
|
|
echo "$DIR_COLOR%1~%f"
|
2020-07-05 17:59:12 +02:00
|
|
|
}
|
|
|
|
|
2021-06-13 19:16:34 +02:00
|
|
|
# Prints current time
|
2020-07-05 17:59:12 +02:00
|
|
|
current_time() {
|
2021-08-25 10:25:26 +02:00
|
|
|
if [ "$MLH_PRINT_TIME" = true ]; then
|
2021-06-13 19:16:34 +02:00
|
|
|
echo " $TIME_COLOR%*%f"
|
|
|
|
fi
|
2020-07-05 17:59:12 +02:00
|
|
|
}
|
|
|
|
|
2021-06-13 19:16:34 +02:00
|
|
|
# Prints exit code of the last executed command
|
|
|
|
exit_code() {
|
2021-08-25 10:25:26 +02:00
|
|
|
if [ "$MLH_PRINT_EXIT_CODE" = true ]; then
|
2021-06-13 19:16:34 +02:00
|
|
|
echo "%(?..%F{001}exit %?)%f"
|
|
|
|
fi
|
2020-07-05 17:59:12 +02:00
|
|
|
}
|
|
|
|
|
2021-08-25 10:25:26 +02:00
|
|
|
prompt_end() {
|
2023-01-23 19:40:42 +01:00
|
|
|
if [ "$UID" -eq 0 ]; then
|
|
|
|
printf "\n$MLH_SHELL_SYMBOL_ROOT"
|
|
|
|
else
|
|
|
|
printf "\n$MLH_SHELL_SYMBOL"
|
|
|
|
fi
|
2021-08-25 10:25:26 +02:00
|
|
|
}
|
|
|
|
|
2021-06-13 19:16:34 +02:00
|
|
|
# Set git_prompt_info text
|
2021-08-25 10:25:26 +02:00
|
|
|
ZSH_THEME_GIT_PROMPT_PREFIX="${MLH_ON_SYMBOL}${BRANCH_COLOR}"
|
2020-07-05 17:59:12 +02:00
|
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
|
|
|
|
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
|
|
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
|
|
|
|
|
|
|
# %B and %b make the text bold
|
2021-08-25 10:25:26 +02:00
|
|
|
PROMPT='%b$(username)$MLH_AT_SYMBOL$(device)$MLH_IN_SYMBOL$(directory)$(git_prompt_info)%b$(prompt_end)'
|
2021-06-13 19:16:34 +02:00
|
|
|
RPROMPT="$(exit_code)$(current_time)"
|