1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-12 08:50:08 +00:00

agnoster: Define Powerline chars with escape sequence, and use same character on

all platforms. Add clarifying comments. This makes everything consistent
with the current Powerline-patched fonts definitions.
This commit is contained in:
Andrew Janke 2015-06-25 20:13:59 -04:00
parent 599831b85a
commit 4cd281ba1b

View file

@ -7,6 +7,9 @@
# #
# In order for this theme to render correctly, you will need a # In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). # [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
# uses changed in 2012, and older versions will display incorrectly,
# in confusing ways.
# #
# In addition, I recommend the # In addition, I recommend the
# [Solarized theme](https://github.com/altercation/solarized/) and, if you're # [Solarized theme](https://github.com/altercation/solarized/) and, if you're
@ -27,12 +30,19 @@
CURRENT_BG='NONE' CURRENT_BG='NONE'
# Fix odd char on mac # Special Powerline characters
if [[ `uname` == 'Darwin' ]]; then
SEGMENT_SEPARATOR='\ue0b0' # NOTE: This segment separator character is correct. In 2012, Powerline changed
else # the code points they use for their special characters. This is the new code point.
SEGMENT_SEPARATOR='' # If this is not working for you, you probably have an old version of the
fi # Powerline-patched fonts installed. Download and install the new version.
# Do not submit PRs to change this unless you have reviewed the Powerline code point
# history and have new information.
# This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of
# what font the user is viewing this source code in. Do not replace the
# escape sequence with a single literal character.
SEGMENT_SEPARATOR='\ue0b0' # 
# Begin a segment # Begin a segment
# Takes two arguments, background and foreground. Both can be omitted, # Takes two arguments, background and foreground. Both can be omitted,
@ -73,6 +83,7 @@ prompt_context() {
# Git: branch/detached head, dirty status # Git: branch/detached head, dirty status
prompt_git() { prompt_git() {
local PL_BRANCH_CHAR='\ue0a0' # 
local ref dirty mode repo_path local ref dirty mode repo_path
repo_path=$(git rev-parse --git-dir 2>/dev/null) repo_path=$(git rev-parse --git-dir 2>/dev/null)
@ -104,7 +115,7 @@ prompt_git() {
zstyle ':vcs_info:*' formats ' %u%c' zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c' zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info vcs_info
echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_%% }${mode}" echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
fi fi
} }