diff --git a/README.md b/README.md index 4aeab18df7047978649c0df061fd871a434ad167..a45667e4dbf7a849cf22bb6c94853ad9d673d080 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ For Mac users, I highly recommend iTerm 2 + Solarized Dark # Compatibility -**NOTE:** In all likelihood, you will need to install a [Powerline-patched font](https://gist.github.com/1595572) for this theme to render correctly. +**NOTE:** In all likelihood, you will need to install a [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts) for this theme to render correctly. -To test if your terminal and font support it, check that all the necessary characters are supported by copying the following command to your terminal: `echo " ± ➦ ✘ ⚡"`. The result should look like this: +To test if your terminal and font support it, check that all the necessary characters are supported by copying the following command to your terminal: `echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"`. The result should look like this: - + ## What does it show? diff --git a/agnoster.zsh-theme b/agnoster.zsh-theme index b37a325b9b96a7f15dd724cb04acce3645f7a289..ed99c88f49137e45c4fd4d631bb0d25e3a77d9a4 100644 --- a/agnoster.zsh-theme +++ b/agnoster.zsh-theme @@ -26,7 +26,15 @@ # A few utility functions to make it easy and re-usable to draw segmented prompts CURRENT_BG='NONE' -SEGMENT_SEPARATOR='' + +# Characters +SEGMENT_SEPARATOR="\ue0b0" +PLUSMINUS="\u00b1" +BRANCH="\ue0a0" +DETACHED="\u27a6" +CROSS="\u2718" +LIGHTNING="\u26a1" +GEAR="\u2699" # Begin a segment # Takes two arguments, background and foreground. Both can be omitted, @@ -71,15 +79,15 @@ prompt_context() { prompt_git() { local ref dirty if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then - ZSH_THEME_GIT_PROMPT_DIRTY='±' + ZSH_THEME_GIT_PROMPT_DIRTY=$PLUSMINUS dirty=$(parse_git_dirty) - ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)" + ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="$DETACHED $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)" if [[ -n $dirty ]]; then prompt_segment yellow black else prompt_segment green black fi - echo -n "${ref/refs\/heads\// }$dirty" + echo -n "${ref/refs\/heads\//$BRANCH }$dirty" fi } @@ -95,9 +103,9 @@ prompt_dir() { prompt_status() { local symbols symbols=() - [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" - [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" - [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" + [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}$CROSS" + [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}$LIGHTNING" + [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}$GEAR" [[ -n "$symbols" ]] && prompt_segment black default "$symbols" } diff --git a/characters.png b/characters.png new file mode 100644 index 0000000000000000000000000000000000000000..22bb0cb709b54cfa3b17827d79238c34386b5cc2 Binary files /dev/null and b/characters.png differ