Skip to content
Snippets Groups Projects
Commit 9d5e1cd9 authored by Isaac Wolkerstorfer's avatar Isaac Wolkerstorfer
Browse files

Get replace unicode with named characters

parent a01d483f
No related branches found
No related tags found
No related merge requests found
......@@ -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:
![Character Example](http://cl.ly/content/image/2l3w443z363P/aHR0cDovL2YuY2wubHkvaXRlbXMvM2ozTjJpMDMzTzJNM0ozcDFjMjgvU2NyZWVuJTIwU2hvdCUyMDIwMTItMDktMTQlMjBhdCUyMDEyLjA2LjAyJTIwLnBuZw==)
![Character Example](https://gist.githubusercontent.com/agnoster/3712874/raw/characters.png)
## What does it show?
......
......@@ -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"
}
......
characters.png

14.9 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment