summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Ritter <dominik.ritter@pixelhouse.de>2015-03-29 22:42:28 +0300
committerDominik Ritter <dominik.ritter@pixelhouse.de>2015-03-29 22:42:28 +0300
commit731f43e22b6a2d1dd24fc4edd97430b9f5d672f1 (patch)
tree826bc1fb96bdab88dad3a20728129ce35b728ffc
parent4020b25a431c26171cc46673a247311fd993215f (diff)
Show revision-Changeset, if POWERLEVEL9K_SHOW_CHANGESET is enabled.
-rw-r--r--README.md6
-rw-r--r--powerlevel9k.zsh-theme17
2 files changed, 20 insertions, 3 deletions
diff --git a/README.md b/README.md
index fd89cc81..2aefc839 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 83d55e8f..cdb04d8a 100644
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -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