Limit branch name length

This commit is contained in:
Andrew Tomaka 2023-08-29 23:19:09 -04:00
parent 8aaaba07fe
commit 87d65db1e5
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
2 changed files with 12 additions and 0 deletions

View file

@ -4,9 +4,19 @@ precmd() {
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*:prompt:*' formats "(%b)"
zstyle ':vcs_info:git*+set-message:*' hooks git-branch
vcs_info 'prompt'
}
function +vi-git-branch() {
local branch_name=${hook_com[branch]}
local readonly max=${ZDOT_MAX_BRANCH_LENGTH:-20}
if [[ ${#branch_name} -gt $max ]]; then
hook_com[branch]="${branch_name:0:($max - 1)}…"
fi
}
local current_time="[%B%D{%T}%b]"
local current_dir='%~%f'
local current_branch='${vcs_info_msg_0_}'

View file

@ -1,5 +1,7 @@
ZDOTDIR=$HOME/.config/zsh
ZDOT_MAX_BRANCH_LENGTH=30
XDG_CONFIG_HOME="$HOME/.config"
PERSONAL_BIN_PATH="$HOME/bin"