gitzshoh-my-zshpowerline

Shorten branch names in terminal with powerlevel9k and zsh


I am currently using powerlevel9k in zsh. It shows me my current directory, the current VCS branch I'm on (git in this case). While I can limit the number of directories shown (i.e. show no more than 2 directories), I don't know how to limit the git branch name to be shown.

If I have a branch name called this-is-a-really-long-branch-name-for-no-good-reason, then it takes over my terminal and the lines wrap. This is specifically annoying when working in multiple panes. I would like to suppress it after say 30 characters. What's the best way to do this?


Solution

  • There is already a Pull Request for this. Have a look at #798. It will arrive at the next branch shortly. It would be awesome, if you could try it out, and document your findings in the Pull Request. You can find the documentation for that here (after the Symbols description).