How can I configure the theme to always show the commit hash I'm currently on?
Do you have a file named ~/.p10k.zsh?
Do you have a file named
~/.p10k.zsh?
If the answer is yes, open the file and find these lines:
Replace them with this:
# '@72f5c8a' if in a non-empty repo, followed by a space if on a branch.
vcs+='${VCS_STATUS_COMMIT:+%f@%76F${VCS_STATUS_COMMIT[1,8]}${VCS_STATUS_LOCAL_BRANCH:+ }}'
# If on a branch...
vcs+='${VCS_STATUS_LOCAL_BRANCH:+%76F'${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}
# If local branch name is at most 32 characters long, show it in full.
vcs+='${${${$(($#VCS_STATUS_LOCAL_BRANCH<=32)):#0}:+${VCS_STATUS_LOCAL_BRANCH//\%/%%}}'
# If local branch name is over 32 characters long, show the first 12 … the last 12.
vcs+=':-${VCS_STATUS_LOCAL_BRANCH[1,12]//\%/%%}%28F…%76F${VCS_STATUS_LOCAL_BRANCH[-12,-1]//\%/%%}}}'
Customize it to your liking. There are enough comments to allow for tinkering even for non-experts in ZSH.
If you don't have ~/.p10k.zsh, add POWERLEVEL9K_SHOW_CHANGESET=true to your ~/.zshrc. If this doesn't work, post the output of typeset -m 'POWERLEVEL9K_*'.
Thanks!
Thanks!
Thanks a lot for reporting this!
Thanks!
Thanks a lot for reporting this!
This is really awkward but I posted this comment to the wrong issue :man_facepalming:
I'm glad you have your configuration sorted out and all :grin:
For anyone looking for the context of how to edit this and you used the wizard when making your ~/.p10k.zsh file the one referenced is far more robust and allows you to customize it beyond the stock one. I didn't pick up on that at first and was unable to find any of the code referenced until I realized the source of the above example can be copy pasted or edited in to your file.
If you want Git status in your prompt to always show the current commit, run p10k configure to generate ~/.p10k.zsh. Then open ~/.p10k.zsh and search for this piece:
# Display the current Git commit if there is no branch or tag.
# Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line.
[[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}"
Heed the tip.
Most helpful comment
If the answer is yes, open the file and find these lines:
https://github.com/romkatv/powerlevel10k/blob/e537a0ee628341741f20a7d2d96ea1c4fac74c4a/config/p10k-lean.zsh#L279-L286
Replace them with this:
Customize it to your liking. There are enough comments to allow for tinkering even for non-experts in ZSH.
If you don't have
~/.p10k.zsh, addPOWERLEVEL9K_SHOW_CHANGESET=trueto your~/.zshrc. If this doesn't work, post the output oftypeset -m 'POWERLEVEL9K_*'.