c47ac2d86d1aec3dcc3106c58d3ef0a91aa8cc3c
- Author
- Bartek Pacia <barpac02@gmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
feat(mlh): let users configure the official MLH theme (#9997)
Diff
1diff --git a/themes/mlh.zsh-theme b/themes/mlh.zsh-theme
2index 33f238ed9349abb5043103ff6f8bee6ecc1009ad..baff3fb6331591d538929cecbc57a2f845805123 100644
3--- a/themes/mlh.zsh-theme
4+++ b/themes/mlh.zsh-theme
5@@ -12,17 +12,40 @@
6 # # # Feel free to customize! # # #
7 # # # # # # # # # # # # # # # # # #
8
9+# To customize symbols (e.g MLH_AT_SYMBOL), simply set them as environment variables
10+# for example in your ~/.zshrc file, like this:
11+# MLH_AT_SYMBOL=" at "
12+#
13+# Settings *must* be set before sourcing oh-my-zsh.sh the .zshrc file.
14+#
15 # To easily discover colors and their codes, type `spectrum_ls` in the terminal
16
17-# enable or disable particular elements
18-PRINT_EXIT_CODE=true
19-PRINT_TIME=true
20+# right prompt default settings
21+if [ -z "$MLH_PRINT_EXIT_CODE" ]; then
22+ MLH_PRINT_EXIT_CODE=true
23+fi
24
25-# symbols
26-AT_SYMBOL=" @ "
27-IN_SYMBOL=" in "
28-ON_SYMBOL=" on "
29-SHELL_SYMBOL="$"
30+if [ -z "$MLH_PRINT_TIME" ]; then
31+ MLH_PRINT_TIME=false
32+fi
33+
34+# left prompt symbols default settings
35+
36+if [ -z "$MLH_AT_SYMBOL" ]; then
37+ MLH_AT_SYMBOL="@"
38+fi
39+
40+if [ -z "$MLH_IN_SYMBOL" ]; then
41+ MLH_IN_SYMBOL=" in "
42+fi
43+
44+if [ -z "$MLH_ON_SYMBOL" ]; then
45+ MLH_ON_SYMBOL=" on "
46+fi
47+
48+if [ -z "$MLH_SHELL_SYMBOL" ]; then
49+ MLH_SHELL_SYMBOL="$ "
50+fi
51
52 # colors
53 USER_COLOR="%F{001}"
54@@ -47,24 +70,28 @@ directory() {
55
56 # Prints current time
57 current_time() {
58- if [ "$PRINT_TIME" = true ]; then
59+ if [ "$MLH_PRINT_TIME" = true ]; then
60 echo " $TIME_COLOR%*%f"
61 fi
62 }
63
64 # Prints exit code of the last executed command
65 exit_code() {
66- if [ "$PRINT_EXIT_CODE" = true ]; then
67+ if [ "$MLH_PRINT_EXIT_CODE" = true ]; then
68 echo "%(?..%F{001}exit %?)%f"
69 fi
70 }
71
72+prompt_end() {
73+ printf "\n$MLH_SHELL_SYMBOL"
74+}
75+
76 # Set git_prompt_info text
77-ZSH_THEME_GIT_PROMPT_PREFIX="${ON_SYMBOL}${BRANCH_COLOR}"
78+ZSH_THEME_GIT_PROMPT_PREFIX="${MLH_ON_SYMBOL}${BRANCH_COLOR}"
79 ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
80 ZSH_THEME_GIT_PROMPT_DIRTY=""
81 ZSH_THEME_GIT_PROMPT_CLEAN=""
82
83 # %B and %b make the text bold
84-PROMPT='%b$(username)$AT_SYMBOL$(device)$IN_SYMBOL$(directory)$(git_prompt_info)%b $SHELL_SYMBOL '
85+PROMPT='%b$(username)$MLH_AT_SYMBOL$(device)$MLH_IN_SYMBOL$(directory)$(git_prompt_info)%b$(prompt_end)'
86 RPROMPT="$(exit_code)$(current_time)"