diff options
author | Ramses Ladlani <ramses.ladlani@fishingcactus.com> | 2015-09-21 08:49:18 +0200 |
---|---|---|
committer | Ramses Ladlani <ramses.ladlani@fishingcactus.com> | 2015-09-21 08:49:18 +0200 |
commit | 7576f856b915e6e02c5990cd7e221d7b9efbe44a (patch) | |
tree | be3fe162edbc04946eea014a3612280d4909dc1e /themes/agnoster.zsh-theme | |
parent | 6e0fcf803fe00445c97861360d1b0806d8cc56b8 (diff) | |
parent | 918d26e7dbcb907e673df24242c9688cd89019b9 (diff) | |
download | zsh-7576f856b915e6e02c5990cd7e221d7b9efbe44a.tar.gz zsh-7576f856b915e6e02c5990cd7e221d7b9efbe44a.tar.bz2 zsh-7576f856b915e6e02c5990cd7e221d7b9efbe44a.zip |
Merge remote-tracking branch 'robyrussel/master' into fix-atom_plugin_for_cygwin
Discarded all previous changes to atom plugin for easier review in next commit.
Diffstat (limited to 'themes/agnoster.zsh-theme')
-rw-r--r-- | themes/agnoster.zsh-theme | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 3a0c58b89..e54346acf 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -7,6 +7,9 @@ # # In order for this theme to render correctly, you will need a # [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 # [Solarized theme](https://github.com/altercation/solarized/) and, if you're @@ -27,12 +30,21 @@ CURRENT_BG='NONE' -# Fix odd char on mac -if [[ `uname` == 'Darwin' ]]; then - SEGMENT_SEPARATOR='\ue0b0' -else - SEGMENT_SEPARATOR='' -fi +# Special Powerline characters + +() { + local LC_ALL="" LC_CTYPE="en_US.UTF-8" + # NOTE: This segment separator character is correct. In 2012, Powerline changed + # the code points they use for their special characters. This is the new code point. + # If this is not working for you, you probably have an old version of the + # 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 # Takes two arguments, background and foreground. Both can be omitted, @@ -73,12 +85,18 @@ prompt_context() { # Git: branch/detached head, dirty status prompt_git() { + + local PL_BRANCH_CHAR + () { + local LC_ALL="" LC_CTYPE="en_US.UTF-8" + PL_BRANCH_CHAR=$'\ue0a0' # + } local ref dirty mode repo_path repo_path=$(git rev-parse --git-dir 2>/dev/null) if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then 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="➦ $(git rev-parse --short HEAD 2> /dev/null)" if [[ -n $dirty ]]; then prompt_segment yellow black else @@ -104,7 +122,7 @@ prompt_git() { zstyle ':vcs_info:*' formats ' %u%c' zstyle ':vcs_info:*' actionformats ' %u%c' 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 } |