X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=zsh%2Frc;h=487c4bc1bf5d103a7275a4fd2254dbe02c0a62ca;hb=9445ccedb42e2ad042842302ae79139c9d80ca47;hp=e51ebfd8803f05ee94a3c16c862486c66e4b9586;hpb=e30b4cd857c6081c42db3c346583aae6dc03650d;p=config%2Fdotfiles.git diff --git a/zsh/rc b/zsh/rc index e51ebfd..487c4bc 100644 --- a/zsh/rc +++ b/zsh/rc @@ -154,9 +154,9 @@ if [[ $ZSH_VERSION == (4.3.<9->|4.<4->*|<5->*) || fi # Allow substitutions and expansions in the prompt, necessary for - # VCS_info. + # VCS_Info. setopt promptsubst - # Load VCS_info to display information about version control repositories. + # Load VCS_Info to display information about version control repositories. autoload -Uz vcs_info # Only look for git and mercurial repositories; the only I use. zstyle ':vcs_info:*' enable git hg @@ -164,13 +164,24 @@ if [[ $ZSH_VERSION == (4.3.<9->|4.<4->*|<5->*) || # below). This comes with a speed penalty for bigger repositories. zstyle ':vcs_info:*' check-for-changes true - # Set style of VCS_info display. The current branch (green) and VCS (blue) + # Set style of VCS_Info display. The current branch (green) and VCS (blue) # is displayed. If there is an special action going on (merge, rebase) - # it's also displayed (red). - zstyle ':vcs_info:*' formats \ - "($green%b%u%c$default:$blue%s$default)" - zstyle ':vcs_info:*' actionformats \ - "($green%b$default/$red%a$default:$blue%s$default)" + # it's also displayed (red). Also display if there are unstaged or staged + # (%u/%c) changes. + if [[ $ZSH_VERSION == (4.3.<11->|4.<4->*|<5->*) || + -d ~/.zsh/functions/vcs_info ]]; then + zstyle ':vcs_info:*' formats \ + "($green%b%u%c$default:$blue%s$default)" + zstyle ':vcs_info:*' actionformats \ + "($green%b%u%c$default/$red%a$default:$blue%s$default)" + else + # In older versions %u and %c are not defined yet and are not + # correctly expanded. + zstyle ':vcs_info:*' formats \ + "($green%b$default:$blue%s$default)" + zstyle ':vcs_info:*' actionformats \ + "($green%b$default/$red%a$default:$blue%s$default)" + fi # Set style for formats/actionformats when unstaged (%u) and staged (%c) # changes are detected in the repository; check-for-changes must be set to # true for this to work. Thanks to Bart Trojanowski @@ -179,7 +190,7 @@ if [[ $ZSH_VERSION == (4.3.<9->|4.<4->*|<5->*) || zstyle ':vcs_info:*' unstagedstr '¹' zstyle ':vcs_info:*' stagedstr '²' - # Call VCS_info as precmd before every prompt. + # Call VCS_Info as precmd before every prompt. prompt_precmd() { vcs_info }