diff --git a/zsh/.config/zsh/prompt b/zsh/.config/zsh/prompt index f806ddb..59ea34a 100644 --- a/zsh/.config/zsh/prompt +++ b/zsh/.config/zsh/prompt @@ -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_}' diff --git a/zsh/.zshenv b/zsh/.zshenv index 3407918..48e106f 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,5 +1,7 @@ ZDOTDIR=$HOME/.config/zsh +ZDOT_MAX_BRANCH_LENGTH=30 + XDG_CONFIG_HOME="$HOME/.config" PERSONAL_BIN_PATH="$HOME/bin"