gitterminalzshoh-my-zsh

Keep Git Branch Name Untruncated in Shell using p10k (Oh My Zsh theme)


I'm using a Mac (Catalina), iTerm2, Oh My Zsh (https://ohmyz.sh/), and the p10k zsh theme (https://github.com/romkatv/powerlevel10k).

Currently my git branches are showing truncated names on iTerm2 (like davidb/my-kewl...branch) instead of the untruncted branch names, like:
davidb/my-kewl-feature-branch

How do I turn off git branch name truncating? I want the untruncated git branch names.

Per https://github.com/romkatv/powerlevel10k/issues/193, I'm unsure how to use the code below in my ~/.p10k.zs file to turn off git branch name truncating. I've already tried many combinations, including Google searches, and nothing worked.

POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=32
POWERLEVEL9K_VCS_SHORTEN_LENGTH=12
POWERLEVEL9K_VCS_SHORTEN_STRATEGY=truncate_middle

Solution

  • As of October 2024, the line to delete is 407

    (( $#branch > 32 )) && branch[13,-13]="…"  # <-- this line