Show revision-Changeset, if POWERLEVEL9K_SHOW_CHANGESET is enabled.

This commit is contained in:
Dominik Ritter 2015-03-29 21:42:28 +02:00
parent 4020b25a43
commit 731f43e22b
2 changed files with 20 additions and 3 deletions

View File

@ -77,6 +77,11 @@ To specify which segments you want, just add the following variables to your
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history time)
If you want to show the current changeset, enable `POWERLEVEL9K_SHOW_CHANGESET`
in your `~/.zshrc`:
POWERLEVEL9K_SHOW_CHANGESET=true
#### Conditional 'context'
The `context` segment (user@host string) is conditional. This lets you enable it, but only display
@ -88,7 +93,6 @@ elements (it is by default), and define a `DEFAULT_USER` in your `~/.zshrc`:
export DEFAULT_USER=<your username>
### Bugs / Contact
If you have any requests or bug reports, please use the tracker in this Github

View File

@ -32,16 +32,21 @@ VCS_STAGED_ICON='✚'
# vcs_info settings for git
################################################################
local VCS_WORKDIR_DIRTY=false
setopt prompt_subst
autoload -Uz vcs_info
local VCS_WORKDIR_DIRTY=false
local VCS_CHANGESET_PREFIX=''
if ( $POWERLEVEL9K_SHOW_CHANGESET ); then
VCS_CHANGESET_PREFIX='%12.12i@'
fi
zstyle ':vcs_info:*' enable git hg
# The `get-revision` function must be turned on for dirty-check to work for Hg
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' formats "%b%c%u%m"
zstyle ':vcs_info:*' formats " $VCS_CHANGESET_PREFIX%b%c%u%m"
zstyle ':vcs_info:*' actionformats "%b %F{red}| %a%f"
zstyle ':vcs_info:*' stagedstr " %F{black}$VCS_STAGED_ICON%f"
@ -52,6 +57,14 @@ zstyle ':vcs_info:git*+set-message:*' hooks git-untracked git-aheadbehind git-re
# For Hg, only show the branch name (as opposed to the rev)
zstyle ':vcs_info:hg*:*' branchformat "%b"
if ( $POWERLEVEL9K_SHOW_CHANGESET ); then
zstyle ':vcs_info:*' get-revision true # If false, the dirty-check won't work in mercurial
else
# A little performance-boost (at least for mercurial). If we don't show
# the changeset, we can switch to simple mode.
zstyle ':vcs_info:*' use-simple true
fi
## Debugging
#zstyle ':vcs_info:*+*:*' debug true