diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 5564655..3d95e39 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,6 +1,16 @@ -# Enable colors and change prompt: +git_prompt() { + local branch="$(git symbolic-ref HEAD 2> /dev/null | cut -d'/' -f3-)" + local branch_truncated="${branch:0:30}" + if (( ${#branch} > ${#branch_truncated} )); then + branch="${branch_truncated}..." + fi + + [ -n "${branch}" ] && echo " (${branch})" +} + +setopt PROMPT_SUBST autoload -U colors && colors # Load colors -PROMPT='%1~%f%b $ ' +PROMPT='%1~%f%b%F{blue}$(git_prompt)%f $ ' # gpg key for ssh authentication export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"