Merge pull request #17 from dritter/dritter/changeset_hash_length

Make changeset hash length configurable
pull/22/head
Ben Hilburn 10 years ago
commit 5b0eeadabb

@ -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 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 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 POWERLEVEL9K_SHOW_CHANGESET=true
# just show the 6 first characters of changeset
POWERLEVEL9K_CHANGESET_HASH_LENGTH=6
### Styling ### Styling

@ -53,8 +53,13 @@ autoload -Uz vcs_info
local VCS_WORKDIR_DIRTY=false local VCS_WORKDIR_DIRTY=false
local VCS_CHANGESET_PREFIX='' local VCS_CHANGESET_PREFIX=''
if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then
# Just display the first 12 characters of our changeset-ID. # Default: Just display the first 12 characters of our changeset-ID.
VCS_CHANGESET_PREFIX="%F{$DEFAULT_COLOR_DARK}%12.12i@%f" 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}%0.$VCS_CHANGESET_HASH_LENGTH""i@%f"
fi fi
zstyle ':vcs_info:*' enable git hg zstyle ':vcs_info:*' enable git hg

Loading…
Cancel
Save