mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 09:41:20 +08:00
style(mlh): update the official theme of Major League Hacking (#9971)
* allow for customization of RPROMPT (exit code and timestamp) * improve code and comments
This commit is contained in:
parent
5152d381bb
commit
adcb5c5e07
|
@ -1,4 +1,5 @@
|
||||||
# The Official Theme of
|
# The Official Theme of Major League Hacking
|
||||||
|
|
||||||
## ## ## ## ##
|
## ## ## ## ##
|
||||||
### ### ## ## ##
|
### ### ## ## ##
|
||||||
#### #### ## ## ##
|
#### #### ## ## ##
|
||||||
|
@ -13,11 +14,17 @@
|
||||||
|
|
||||||
# To easily discover colors and their codes, type `spectrum_ls` in the terminal
|
# To easily discover colors and their codes, type `spectrum_ls` in the terminal
|
||||||
|
|
||||||
|
# enable or disable particular elements
|
||||||
|
PRINT_EXIT_CODE=true
|
||||||
|
PRINT_TIME=true
|
||||||
|
|
||||||
|
# symbols
|
||||||
AT_SYMBOL=" @ "
|
AT_SYMBOL=" @ "
|
||||||
IN_SYMBOL=" in "
|
IN_SYMBOL=" in "
|
||||||
ON_SYMBOL=" on "
|
ON_SYMBOL=" on "
|
||||||
SYMBOL="$"
|
SHELL_SYMBOL="$"
|
||||||
|
|
||||||
|
# colors
|
||||||
USER_COLOR="%F{001}"
|
USER_COLOR="%F{001}"
|
||||||
DEVICE_COLOR="%F{033}"
|
DEVICE_COLOR="%F{033}"
|
||||||
DIR_COLOR="%F{220}"
|
DIR_COLOR="%F{220}"
|
||||||
|
@ -28,32 +35,36 @@ username() {
|
||||||
echo "$USER_COLOR%n%f"
|
echo "$USER_COLOR%n%f"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Returns device name
|
# Prints device name
|
||||||
device() {
|
device() {
|
||||||
echo "$DEVICE_COLOR%m%f"
|
echo "$DEVICE_COLOR%m%f"
|
||||||
}
|
}
|
||||||
|
|
||||||
# The current directory
|
# Prints the current directory
|
||||||
directory() {
|
directory() {
|
||||||
echo "$DIR_COLOR%1~%f"
|
echo "$DIR_COLOR%1~%f"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Current time with milliseconds
|
# Prints current time
|
||||||
current_time() {
|
current_time() {
|
||||||
|
if [ "$PRINT_TIME" = true ]; then
|
||||||
echo " $TIME_COLOR%*%f"
|
echo " $TIME_COLOR%*%f"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Return status of the last command
|
# Prints exit code of the last executed command
|
||||||
return_status() {
|
exit_code() {
|
||||||
echo "%(?..%F{001}out %?)%f"
|
if [ "$PRINT_EXIT_CODE" = true ]; then
|
||||||
|
echo "%(?..%F{001}exit %?)%f"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set the git_prompt_info text
|
# Set git_prompt_info text
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="${ON_SYMBOL}${BRANCH_COLOR}"
|
ZSH_THEME_GIT_PROMPT_PREFIX="${ON_SYMBOL}${BRANCH_COLOR}"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
|
|
||||||
# %B and %b make the text bold
|
# %B and %b make the text bold
|
||||||
PROMPT='%b$(username)$AT_SYMBOL$(device)$IN_SYMBOL$(directory)$(git_prompt_info)%b $SYMBOL '
|
PROMPT='%b$(username)$AT_SYMBOL$(device)$IN_SYMBOL$(directory)$(git_prompt_info)%b $SHELL_SYMBOL '
|
||||||
RPROMPT="$(return_status) $(current_time)"
|
RPROMPT="$(exit_code)$(current_time)"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user