Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
c47ac2d8
Unverified
Commit
c47ac2d8
authored
Aug 25, 2021
by
Bartek Pacia
Committed by
GitHub
Aug 25, 2021
Browse files
feat(mlh): let users configure the official MLH theme (#9997)
parent
e13ff75f
Changes
1
Show whitespace changes
Inline
Side-by-side
themes/mlh.zsh-theme
View file @
c47ac2d8
...
@@ -12,17 +12,40 @@
...
@@ -12,17 +12,40 @@
# # # Feel free to customize! # # #
# # # Feel free to customize! # # #
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# 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.
#
# 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
# right prompt default settings
PRINT_EXIT_CODE=true
if [ -z "$MLH_PRINT_EXIT_CODE" ]; then
PRINT_TIME=true
MLH_PRINT_EXIT_CODE=true
fi
# symbols
if [ -z "$MLH_PRINT_TIME" ]; then
AT_SYMBOL=" @ "
MLH_PRINT_TIME=false
IN_SYMBOL=" in "
fi
ON_SYMBOL=" on "
SHELL_SYMBOL="$"
# 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
# colors
# colors
USER_COLOR="%F{001}"
USER_COLOR="%F{001}"
...
@@ -47,24 +70,28 @@ directory() {
...
@@ -47,24 +70,28 @@ directory() {
# Prints current time
# Prints current time
current_time() {
current_time() {
if [ "$PRINT_TIME" = true ]; then
if [ "$
MLH_
PRINT_TIME" = true ]; then
echo " $TIME_COLOR%*%f"
echo " $TIME_COLOR%*%f"
fi
fi
}
}
# Prints exit code of the last executed command
# Prints exit code of the last executed command
exit_code() {
exit_code() {
if [ "$PRINT_EXIT_CODE" = true ]; then
if [ "$
MLH_
PRINT_EXIT_CODE" = true ]; then
echo "%(?..%F{001}exit %?)%f"
echo "%(?..%F{001}exit %?)%f"
fi
fi
}
}
prompt_end() {
printf "\n$MLH_SHELL_SYMBOL"
}
# Set git_prompt_info text
# Set git_prompt_info text
ZSH_THEME_GIT_PROMPT_PREFIX="${ON_SYMBOL}${BRANCH_COLOR}"
ZSH_THEME_GIT_PROMPT_PREFIX="${
MLH_
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
$SHELL_SYMBOL
'
PROMPT='%b$(username)$
MLH_
AT_SYMBOL$(device)$
MLH_
IN_SYMBOL$(directory)$(git_prompt_info)%b
$(prompt_end)
'
RPROMPT="$(exit_code)$(current_time)"
RPROMPT="$(exit_code)$(current_time)"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment