Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 671
risingPhoenix1979 Avatar asked May 07 '20 21:05

risingPhoenix1979


2 Answers

As of Februray 2021, the line to delete is 389

(( $#branch > 32 )) && branch[13,-13]="…"  # <-- this line
like image 96
Imam Avatar answered Sep 30 '22 07:09

Imam


I got the answer from the p10k zsh theme (https://github.com/romkatv/powerlevel10k) creator Roman on Gitter: https://gitter.im/powerlevel10k/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge

In ~/.pk10.zsh or ~/.p10k.zsh delete, or comment out, line 375 as shown in this Github repo file: https://github.com/romkatv/powerlevel10k/blob/459af1f2382ff53214bf9e4fc598b4e36fb8f8df/config/p10k-lean.zsh#L374

Line to Comment Out or Delete in Repo Link Above

(( $#where > 32 )) && where[13,-13]="…"

Thanks Roman!

like image 31
risingPhoenix1979 Avatar answered Sep 30 '22 07:09

risingPhoenix1979