From 3de82cfa67e782337d05aab774ea75106d67f992 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 31 Mar 2015 00:52:06 +0200 Subject: [PATCH 1/3] Length of changeset-hash is now configurable by setting POWERLEVEL9K_CHANGESET_HASH_LENGTH. --- powerlevel9k.zsh-theme | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 55056bf1..d9e4485d 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -53,8 +53,13 @@ autoload -Uz vcs_info local VCS_WORKDIR_DIRTY=false local VCS_CHANGESET_PREFIX='' if [ $POWERLEVEL9K_SHOW_CHANGESET ]; then - # Just display the first 12 characters of our changeset-ID. - VCS_CHANGESET_PREFIX="%F{$DEFAULT_COLOR_DARK}%12.12i@%f" + # Default: Just display the first 12 characters of our changeset-ID. + local VCS_CHANGESET_HASH_LENGTH=12 + if [[ -n $POWERLEVEL9K_CHANGESET_HASH_LENGTH ]]; then + VCS_CHANGESET_HASH_LENGTH=$POWERLEVEL9K_CHANGESET_HASH_LENGTH + fi + + VCS_CHANGESET_PREFIX="%F{$DEFAULT_COLOR_DARK}%$VCS_CHANGESET_HASH_LENGTH.$VCS_CHANGESET_HASH_LENGTH""i@%f" fi zstyle ':vcs_info:*' enable git hg From c57e46f63deddd251761dfbc43ea98655f86417a Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 31 Mar 2015 00:57:15 +0200 Subject: [PATCH 2/3] Added documentation --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 286a0591..74644d70 100644 --- a/README.md +++ b/README.md @@ -109,9 +109,15 @@ elements (it is by default), and define a `DEFAULT_USER` in your `~/.zshrc`: By default, the `vcs` segment will provide quite a bit of information. If you would also like for it to display the current hash / changeset, simply define -`POWERLEVEL9K_SHOW_CHANGESET` in your `~/.zshrc`: +`POWERLEVEL9K_SHOW_CHANGESET` in your `~/.zshrc`. If activated, it will show +the first 12 characters of the changeset id. To change the amount of characters, +set `POWERLEVEL9K_CHANGESET_HASH_LENTH` to any value you want. +Example: + # enable the vcs segment in general POWERLEVEL9K_SHOW_CHANGESET=true + # just show the 6 first characters of changeset + POWERLEVEL9K_CHANGESET_HASH_LENGTH=6 ### Styling From e23a3c47c41557ec97ea0a819070fd2c4bdb3b68 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 1 Apr 2015 08:53:28 +0200 Subject: [PATCH 3/3] Show at maximum the configured amount of characters. If the changeset id exeeds that limit, just show the full changeset id. --- powerlevel9k.zsh-theme | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index ef4bac9b..c8a9ac89 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -55,11 +55,11 @@ local VCS_CHANGESET_PREFIX='' if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then # Default: Just display the first 12 characters of our changeset-ID. local VCS_CHANGESET_HASH_LENGTH=12 - if [[ -n $POWERLEVEL9K_CHANGESET_HASH_LENGTH ]]; then - VCS_CHANGESET_HASH_LENGTH=$POWERLEVEL9K_CHANGESET_HASH_LENGTH - fi - - VCS_CHANGESET_PREFIX="%F{$DEFAULT_COLOR_DARK}%$VCS_CHANGESET_HASH_LENGTH.$VCS_CHANGESET_HASH_LENGTH""i@%f" + if [[ -n $POWERLEVEL9K_CHANGESET_HASH_LENGTH ]]; then + VCS_CHANGESET_HASH_LENGTH=$POWERLEVEL9K_CHANGESET_HASH_LENGTH + fi + + VCS_CHANGESET_PREFIX="%F{$DEFAULT_COLOR_DARK}%0.$VCS_CHANGESET_HASH_LENGTH""i@%f" fi zstyle ':vcs_info:*' enable git hg